Skip to content

Commit 86299f8

Browse files
authored
Use msbuild dll path where applicable for obtaining appropriate version (#665)
1 parent 7d25c03 commit 86299f8

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/Microsoft.VisualStudio.SlnGen/Program.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,13 @@ internal static int Execute(ProgramArguments arguments, IConsole console)
145145

146146
bool useSimpleCache = true;
147147

148-
var msbuildVersion = FileVersionInfo.GetVersionInfo(CurrentDevelopmentEnvironment.MSBuildExe.FullName);
148+
#if NETFRAMEWORK
149+
string msBuildPath = CurrentDevelopmentEnvironment.MSBuildExe.FullName;
150+
#else
151+
string msBuildPath = CurrentDevelopmentEnvironment.MSBuildDll.FullName;
152+
#endif
153+
154+
var msbuildVersion = FileVersionInfo.GetVersionInfo(msBuildPath);
149155

150156
// Work around https://github.com/dotnet/msbuild/issues/11394 by falling back to the slower PRE cache
151157
// on known-affected MSBuild versions (this should be much more tightly scoped after that bug is fixed).
@@ -159,11 +165,7 @@ internal static int Execute(ProgramArguments arguments, IConsole console)
159165
CacheFileEnumerations = true,
160166
LoadAllFilesAsReadOnly = true,
161167
UseSimpleProjectRootElementCacheConcurrency = useSimpleCache,
162-
#if NETFRAMEWORK
163-
MSBuildExePath = CurrentDevelopmentEnvironment.MSBuildExe.FullName,
164-
#else
165-
MSBuildExePath = CurrentDevelopmentEnvironment.MSBuildDll.FullName,
166-
#endif
168+
MSBuildExePath = msBuildPath,
167169
};
168170

169171
LoggerVerbosity verbosity = ForwardingLogger.ParseLoggerVerbosity(arguments.Verbosity?.LastOrDefault());

0 commit comments

Comments
 (0)