[automated] Merge branch 'release/8.0.3xx' => 'main' (#19451)

This commit is contained in:
Michael Yanni 2024-04-15 11:15:09 -07:00 committed by GitHub
commit 573c98a59e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -24,7 +24,8 @@ namespace Microsoft.DotNet.Cli.Build
AddFolder(sb,
@"MSBuildSdkResolver",
@"MSBuild\Current\Bin\SdkResolvers\Microsoft.DotNet.MSBuildSdkResolver");
@"MSBuild\Current\Bin\SdkResolvers\Microsoft.DotNet.MSBuildSdkResolver",
ngenAssemblies: true);
AddFolder(sb,
@"msbuildExtensions",
@ -39,7 +40,7 @@ namespace Microsoft.DotNet.Cli.Build
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);
var files = Directory.GetFiles(sourceFolder)
@ -55,7 +56,14 @@ namespace Microsoft.DotNet.Cli.Build
{
sb.Append(@" file source=""$(PkgVS_Redist_Common_Net_Core_SDK_MSBuildExtensions)\");
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.AppendLine();
}
sb.AppendLine();
@ -67,6 +75,7 @@ namespace Microsoft.DotNet.Cli.Build
string newRelativeSourcePath = Path.Combine(relativeSourcePath, subfolderName);
string newSwrInstallDir = Path.Combine(swrInstallDir, subfolderName);
// Don't propagate ngenAssemblies to subdirectories.
AddFolder(sb, newRelativeSourcePath, newSwrInstallDir);
}
}