-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make the workload resolver only light up for the specific entrypoint SDKs we control #41268
base: main
Are you sure you want to change the base?
make the workload resolver only light up for the specific entrypoint SDKs we control #41268
Conversation
773d911
to
8618076
Compare
The workload resolver also resolves imports from workload packs, using the pack ID. So the pattern as is is insufficient. It needs to cover things like |
8618076
to
3a60947
Compare
Thanks @dsplaisted - I checked on GitHub and made some regex patterns that would match all props/targets imports from the packs in the WorkloadManifests.targets that I found there. They are intentionally broad to help reduce the potential for missing something. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you plan to try to do Microsoft.DotNet.MSBuildSdkResolver also? That could improve the perf and experience in Visual Studio and Full Framework MSBuild.
@@ -1,3 +1,4 @@ | |||
<SdkResolver> | |||
<Path>..\..\Microsoft.NET.Sdk.WorkloadMSBuildSdkResolver.dll</Path> | |||
<ResolvableSdkPattern>Microsoft\.NET\.SDK\.WorkloadAutoImportPropsLocator|Microsoft\.NET\.SDK\.WorkloadManifestTargetsLocator|Microsoft\..*|Samsung\..*|GtkSharp\..*</ResolvableSdkPattern> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<ResolvableSdkPattern>Microsoft\.NET\.SDK\.WorkloadAutoImportPropsLocator|Microsoft\.NET\.SDK\.WorkloadManifestTargetsLocator|Microsoft\..*|Samsung\..*|GtkSharp\..*</ResolvableSdkPattern> | |
<ResolvableSdkPattern>Microsoft\..*|Samsung\..*|GtkSharp\..*</ResolvableSdkPattern> |
So it looks like anything starting with Microsoft.
, Samsung.
, or GtkSharp.
will match. Given that, I don't think we need to special case the WorkloadAutoImportPropsLocator or WorkloadManifestTargetsLocator since they both start with Microsoft.
Did you look at all the packs from all the manifests (including Tizen) to make sure that they all match these patterns?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, I can remove the specific matches. These broad patterns are sufficient to cover all the packs I could find on github - so there is a risk that there's some workload that isn't OSS and is broadly used that these patterns wouldn't cover.
I certainly can - it should be pretty simple to do. |
@dsplaisted is the Microsoft.DotNet.MSBuildSdkResolver used by the .NET CLI, or just by VS? I was looking at it and it only targets net472? If not, what's used in the CLI to resolve the 'base' SDKs? |
@@ -37,6 +37,7 @@ | |||
<ItemGroup> | |||
<ManifestLines Include="<SdkResolver>" /> | |||
<ManifestLines Include="<Path>$(_TargetPathRelativePath)</Path>" /> | |||
<ManifestLines Include="<ResolvableSdkPattern>FSharp\.NET\.Sdk|Microsoft\.Build\.Tasks\.Git|Microsoft\.Docker\.Sdk|Microsoft\.NET\.Sdk|Microsoft\.NET\.Sdk\.BlazorWebAssembly|Microsoft\.NET\.Sdk\.Publish|Microsoft\.NET\.Sdk\.Razor|Microsoft\.NET\.Sdk\.StaticWebAssets|Microsoft\.NET\.Sdk\.Web|Microsoft\.NET\.Sdk\.Web\.ProjectSystem|Microsoft\.NET\.Sdk\.WebAssembly|Microsoft\.NET\.Sdk\.WindowsDesktop|Microsoft\.NET\.Sdk\.Worker|Microsoft\.SourceLink\.AzureRepos\.Git|Microsoft\.SourceLink\.Bitbucket\.Git|Microsoft\.SourceLink\.Common|Microsoft\.SourceLink\.GitHub|Microsoft\.SourceLink\.GitLab|NuGet\.Build\.Tasks\.Pack</ResolvableSdkPattern>" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is every SDK that's included in-box today, matched explicitly for ease of review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of them except FSharp.NET.Sdk and NuGet.Build.Tasks.Pack start with Microsoft.
anyway. Do you think it's worth listing all those separately? It also means there will be more regexes to match.
@@ -45,6 +45,7 @@ | |||
<ItemGroup> | |||
<ManifestLines Include="<SdkResolver>" /> | |||
<ManifestLines Include="<Path>$(_TargetPathRelativePath)</Path>" /> | |||
<ManifestLines Include="<ResolvableSdkPattern>Microsoft\..*|Samsung\..*|GtkSharp\..*</ResolvableSdkPattern>" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the content from the xml, just replicated in this 'generation' step for the .NET framework version of this resolver.
I think that happens in MSBuild here: https://github.com/dotnet/msbuild/blob/main/src/Build/BackEnd/Components/SdkResolution/DefaultSdkResolver.cs This works because with a .NET SDK install, MSBuild is already part of it so you can use a relative path from MSBuild instead of having to resolve an SDK version. |
@@ -37,6 +37,7 @@ | |||
<ItemGroup> | |||
<ManifestLines Include="<SdkResolver>" /> | |||
<ManifestLines Include="<Path>$(_TargetPathRelativePath)</Path>" /> | |||
<ManifestLines Include="<ResolvableSdkPattern>FSharp\.NET\.Sdk|Microsoft\.Build\.Tasks\.Git|Microsoft\.Docker\.Sdk|Microsoft\.NET\.Sdk|Microsoft\.NET\.Sdk\.BlazorWebAssembly|Microsoft\.NET\.Sdk\.Publish|Microsoft\.NET\.Sdk\.Razor|Microsoft\.NET\.Sdk\.StaticWebAssets|Microsoft\.NET\.Sdk\.Web|Microsoft\.NET\.Sdk\.Web\.ProjectSystem|Microsoft\.NET\.Sdk\.WebAssembly|Microsoft\.NET\.Sdk\.WindowsDesktop|Microsoft\.NET\.Sdk\.Worker|Microsoft\.SourceLink\.AzureRepos\.Git|Microsoft\.SourceLink\.Bitbucket\.Git|Microsoft\.SourceLink\.Common|Microsoft\.SourceLink\.GitHub|Microsoft\.SourceLink\.GitLab|NuGet\.Build\.Tasks\.Pack</ResolvableSdkPattern>" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of them except FSharp.NET.Sdk and NuGet.Build.Tasks.Pack start with Microsoft.
anyway. Do you think it's worth listing all those separately? It also means there will be more regexes to match.
Looks like there are a bunch of Full Framework test failures, maybe something is off with the filter for that resolver. |
Hilariously, after I asked this question Rainer and I spent 45m talking about the additions to the sdk resolvers required for dotnet/msbuild#11086 so I learned the answer that way 🗡️
I'll do a bit of debugging today 👍 |
After digging in a bit, the reason for the failures is that for full framework the MSBuildSdkResolver actually contains all of the different resolvers in a single assembly. The main reason for this is to prevent adding more assembly loads to VS, which regresses performance gates in that product. What this means for this PR is that
|
@@ -56,6 +56,7 @@ | |||
<VSMSBuildExtensionsContent Include="$(ArtifactsBinDir)Microsoft.DotNet.MSBuildSdkResolver\$(Configuration)\net472\arm64\hostfxr.dll" DeploymentSubpath="MSBuildSdkResolver/arm64/" /> | |||
<VSMSBuildExtensionsContent Include="$(ArtifactsBinDir)Microsoft.DotNet.MSBuildSdkResolver\$(Configuration)\net472\**\Microsoft.Deployment.DotNet.Releases*.dll" DeploymentSubpath="MSBuildSdkResolver/" /> | |||
<VSMSBuildExtensionsContent Include="$(ArtifactsBinDir)Microsoft.DotNet.MSBuildSdkResolver\$(Configuration)\net472\**\Microsoft.DotNet.MSBuildSdkResolver*.dll" DeploymentSubpath="MSBuildSdkResolver/" /> | |||
<VSMSBuildExtensionsContent Include="$(ArtifactsBinDir)Microsoft.DotNet.MSBuildSdkResolver\$(Configuration)\net472\SdkResolvers\**\Microsoft.DotNet.MSBuildSdkResolver.xml" DeploymentSubpath="MSBuildSdkResolver/" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joeloff I think this is the right place to add the generated resolver XML to ensure it gets added to the VSIX, but I don't know how to create/inspect the VSIX to verify. Any guidance I can follow here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The VSIX is just a zip, but it doesn't get produced in the SDK. We only generate the source (.swr file) and VS generates the actual zip, but if you do build -pack
, you should end up with a file under artifacts\packages\Debug\NonShipping
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, that's very helpful! I cracked open the SWR and found:
folder "InstallDir:\MSBuild\Current\Bin\SdkResolvers\Microsoft.DotNet.MSBuildSdkResolver\Microsoft.DotNet.MSBuildSdkResolver\"
file source="$(PkgVS_Redist_Common_Net_Core_SDK_MSBuildExtensions)\MSBuildSdkResolver\Microsoft.DotNet.MSBuildSdkResolver\Microsoft.DotNet.MSBuildSdkResolver.xml"
That to me suggests that I have the layout incorrect because I believe the xml needs to be either adjacent to the dll, or in the SdkResolvers\<ResolverName>\<ResolverName>.xml
layout pattern. So I'll need to go fix that.
That's validated by digging into the nupkg as well:
Here I can see that the directory structure is incorrect.
This is part of #26009
This makes NuGet/Home#13471 easier to diagnose because it removes the workload resolver from the list of resolvers - you can see the before and after here:
before:
after:
We save one line here, and with additional work on the MSBuild side we may be able to reduce the MSBuild resolver wrapper noise in this message.