Skip to content

Commit

Permalink
Avoid SimplePRECache for MSBuild 17.13+ (#658)
Browse files Browse the repository at this point in the history
Work around dotnet/msbuild#11394 by avoiding the buggy codepath for now.
  • Loading branch information
rainersigwald authored Feb 12, 2025
1 parent b99ee99 commit 7d25c03
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/Microsoft.VisualStudio.SlnGen/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,22 @@ internal static int Execute(ProgramArguments arguments, IConsole console)
return 0;
}

bool useSimpleCache = true;

var msbuildVersion = FileVersionInfo.GetVersionInfo(CurrentDevelopmentEnvironment.MSBuildExe.FullName);

// Work around https://github.com/dotnet/msbuild/issues/11394 by falling back to the slower PRE cache
// on known-affected MSBuild versions (this should be much more tightly scoped after that bug is fixed).
if (msbuildVersion.ProductMajorPart == 17 && msbuildVersion.ProductMinorPart >= 13)
{
useSimpleCache = false;
}

MSBuildFeatureFlags featureFlags = new MSBuildFeatureFlags
{
CacheFileEnumerations = true,
LoadAllFilesAsReadOnly = true,
UseSimpleProjectRootElementCacheConcurrency = true,
UseSimpleProjectRootElementCacheConcurrency = useSimpleCache,
#if NETFRAMEWORK
MSBuildExePath = CurrentDevelopmentEnvironment.MSBuildExe.FullName,
#else
Expand Down

0 comments on commit 7d25c03

Please sign in to comment.