Skip to content

Commit 81e1d90

Browse files
committed
Detect PSES module version from test assembly version
1 parent d1541a9 commit 81e1d90

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

test/PowerShellEditorServices.Test.Host/ServerTestsBase.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,20 @@ protected async Task<Tuple<int, int>> LaunchService(
3434
string modulePath = Path.GetFullPath(@"..\..\..\..\..\module");
3535
string scriptPath = Path.Combine(modulePath, "Start-EditorServices.ps1");
3636

37-
// TODO: Need to determine the right module version programmatically!
38-
string editorServicesModuleVersion = "1.4.1";
37+
#if CoreCLR
38+
FileVersionInfo fileVersionInfo =
39+
FileVersionInfo.GetVersionInfo(this.GetType().GetTypeInfo().Assembly.Location);
40+
#else
41+
FileVersionInfo fileVersionInfo =
42+
FileVersionInfo.GetVersionInfo(this.GetType().Assembly.Location);
43+
#endif
44+
45+
string editorServicesModuleVersion =
46+
string.Format(
47+
"{0}.{1}.{2}",
48+
fileVersionInfo.FileMajorPart,
49+
fileVersionInfo.FileMinorPart,
50+
fileVersionInfo.FileBuildPart);
3951

4052
string scriptArgs =
4153
string.Format(

0 commit comments

Comments
 (0)