Skip to content

Commit

Permalink
Revert "[release/8.0.2xx] NGEN Microsoft.DotNet.MSBuildSdkResolver.dl…
Browse files Browse the repository at this point in the history
…l and its dependencies (#17750)" (#19112)

This reverts commit ec0971c.

Fixes [AB#1994786](https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1994786/)

The MSBuild change which took advantage of this was reverted in 17.9 because it introduced issues in installations that don't have the .NET SDK component installed. We are fixing the bug in 9.0 by making changes to the dependencies of `Microsoft.DotNet.MSBuildSdkResolver` (see #39573) so this should stay in main. I am reverting it only in 8.0.3xx / 17.10 to fix the `Build_Ngen_InvalidAssemblyCount` counter which was flagged as a regression by PerfDDRITs.
  • Loading branch information
ladipro authored Mar 20, 2024
1 parent 8ccd582 commit ad3eea4
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions src/core-sdk-tasks/GenerateMSBuildExtensionsSWR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ public override bool Execute()

AddFolder(sb,
@"MSBuildSdkResolver",
@"MSBuild\Current\Bin\SdkResolvers\Microsoft.DotNet.MSBuildSdkResolver",
ngenAssemblies: true);
@"MSBuild\Current\Bin\SdkResolvers\Microsoft.DotNet.MSBuildSdkResolver");

AddFolder(sb,
@"msbuildExtensions",
Expand All @@ -40,7 +39,7 @@ public override bool Execute()
return true;
}

private void AddFolder(StringBuilder sb, string relativeSourcePath, string swrInstallDir, bool ngenAssemblies = false)
private void AddFolder(StringBuilder sb, string relativeSourcePath, string swrInstallDir)
{
string sourceFolder = Path.Combine(MSBuildExtensionsLayoutDirectory, relativeSourcePath);
var files = Directory.GetFiles(sourceFolder)
Expand All @@ -56,16 +55,7 @@ private void AddFolder(StringBuilder sb, string relativeSourcePath, string swrIn
{
sb.Append(@" file source=""$(PkgVS_Redist_Common_Net_Core_SDK_MSBuildExtensions)\");
sb.Append(Path.Combine(relativeSourcePath, Path.GetFileName(file)));
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();
Expand All @@ -77,7 +67,6 @@ private void AddFolder(StringBuilder sb, string relativeSourcePath, string swrIn
string newRelativeSourcePath = Path.Combine(relativeSourcePath, subfolderName);
string newSwrInstallDir = Path.Combine(swrInstallDir, subfolderName);

// Don't propagate ngenAssemblies to subdirectories.
AddFolder(sb, newRelativeSourcePath, newSwrInstallDir);
}
}
Expand Down

0 comments on commit ad3eea4

Please sign in to comment.