[release/8.0.2xx] NGEN Microsoft.DotNet.MSBuildSdkResolver.dll and its dependencies (#17750)
Backport of #17732 to release/8.0.2xx MSBuild.exe currently spends a significant amount of time JITting `Microsoft.DotNet.MSBuildSdkResolver` and its dependencies, see https://github.com/dotnet/msbuild/issues/9303 for details. This PR makes Visual Studio installer add these assemblies to the NGEN queue, which is a necessary condition for eliminating JITting. Just like `Microsoft.Build.*` assemblies, we need to NGEN these with two configurations: vsn.exe so it works in the devenv process, and MSBuild.exe so it works in MSBuild satellite processes.
This commit is contained in:
parent
79d97389f8
commit
f0c4e4e14c
1 changed files with 14 additions and 3 deletions
|
@ -24,7 +24,8 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
|
|
||||||
AddFolder(sb,
|
AddFolder(sb,
|
||||||
@"MSBuildSdkResolver",
|
@"MSBuildSdkResolver",
|
||||||
@"MSBuild\Current\Bin\SdkResolvers\Microsoft.DotNet.MSBuildSdkResolver");
|
@"MSBuild\Current\Bin\SdkResolvers\Microsoft.DotNet.MSBuildSdkResolver",
|
||||||
|
ngenAssemblies: true);
|
||||||
|
|
||||||
AddFolder(sb,
|
AddFolder(sb,
|
||||||
@"msbuildExtensions",
|
@"msbuildExtensions",
|
||||||
|
@ -39,7 +40,7 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddFolder(StringBuilder sb, string relativeSourcePath, string swrInstallDir)
|
private void AddFolder(StringBuilder sb, string relativeSourcePath, string swrInstallDir, bool ngenAssemblies = false)
|
||||||
{
|
{
|
||||||
string sourceFolder = Path.Combine(MSBuildExtensionsLayoutDirectory, relativeSourcePath);
|
string sourceFolder = Path.Combine(MSBuildExtensionsLayoutDirectory, relativeSourcePath);
|
||||||
var files = Directory.GetFiles(sourceFolder)
|
var files = Directory.GetFiles(sourceFolder)
|
||||||
|
@ -55,7 +56,16 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
{
|
{
|
||||||
sb.Append(@" file source=""$(PkgVS_Redist_Common_Net_Core_SDK_MSBuildExtensions)\");
|
sb.Append(@" file source=""$(PkgVS_Redist_Common_Net_Core_SDK_MSBuildExtensions)\");
|
||||||
sb.Append(Path.Combine(relativeSourcePath, Path.GetFileName(file)));
|
sb.Append(Path.Combine(relativeSourcePath, Path.GetFileName(file)));
|
||||||
sb.AppendLine("\"");
|
sb.Append('"');
|
||||||
|
|
||||||
|
if (ngenAssemblies && file.EndsWith(".dll", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
sb.Append(@" vs.file.ngenApplications=""[installDir]\Common7\IDE\vsn.exe""");
|
||||||
|
sb.Append(@" vs.file.ngenApplications=""[installDir]\MSBuild\Current\Bin\MSBuild.exe""");
|
||||||
|
sb.Append(" vs.file.ngenArchitecture=all");
|
||||||
|
}
|
||||||
|
|
||||||
|
sb.AppendLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.AppendLine();
|
sb.AppendLine();
|
||||||
|
@ -67,6 +77,7 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
string newRelativeSourcePath = Path.Combine(relativeSourcePath, subfolderName);
|
string newRelativeSourcePath = Path.Combine(relativeSourcePath, subfolderName);
|
||||||
string newSwrInstallDir = Path.Combine(swrInstallDir, subfolderName);
|
string newSwrInstallDir = Path.Combine(swrInstallDir, subfolderName);
|
||||||
|
|
||||||
|
// Don't propagate ngenAssemblies to subdirectories.
|
||||||
AddFolder(sb, newRelativeSourcePath, newSwrInstallDir);
|
AddFolder(sb, newRelativeSourcePath, newSwrInstallDir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue