-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[Bug]: No way to load NuGet.Frameworks into Default ALC #10228
Comments
Hi @hknielsen, Thank you for reporting this issue. It appears to have the same symptoms as described in issue #10213. We plan to address it as part of the MSBuildLocator API v2 updates (see microsoft/MSBuildLocator#282). I am currently compiling a list of breaking changes, and your contributions to this list are welcome. Please stay tuned - this issue is on our roadmap. |
Hi @YuliiaKovalova, |
@YuliiaKovalova as this is going to be a breaking change, is there any chance this will be in MSBuild that will follow the net9 timeline? (since this needs msbuild changes as well). |
Hi @hknielsen, We will triage this ticket and I will let you know the priority of it. |
Hi @hknielsen, I've thoroughly investigated this ticket and identified that the root cause is related to the runtime's assembly loading mechanism. To illustrate the issue, I've prepared a sample project which I'll attach to this ticket.
This conflict in assembly versions leads to the observed issue.
Please let us know if this workaround helps. We're documenting restrictions for such libraries as part of #10213. |
@YuliiaKovalova it does not work, at least not for our test projects. I think it might be related that its tests and the test system's load in all the assemblies thats in the build folder? |
Yeah confirmed its loaded before the test runs, and even setting up a |
@YuliiaKovalova This repro gives the exact error that I run into; I didnt add the AssemblyResolve, but adding it does not help. |
I see your problem. In the meantime, I have checked that reference to Nuget.Frameworks was removed from MSBuild.ProjectCreation starting from version 11.0.0 Could you upgrade the version of this package ? |
Upgrading that, then I need to also update the |
Oh wait, upgrading that as that also has removed that dependency, let me try on our real project |
@YuliiaKovalova that worked! Tests on various IDE's and computers, with various dotnet sdk's. Thanks for the help, this so nice to get solved :) |
@hknielsen thank you for updates! I am sure this discussion will be useful for other customers too. Have a nice day! |
Issue Description
While using in-proc BuildManager, theres no way to properly handle NuGet.Frameworks loading.
https://github.com/dotnet/msbuild/blob/main/src/Build/Utilities/NuGetFrameworkWrapper.cs#L56
assemblyName
are never set while running in none msbuild.exe or Visual Studio, and as far as I can tell, its loaded into a separate temp ALC, and not the default as the rest of the Microsoft Build assemblies.Either it should be possible to setup that one want it to be loaded into the Default ALC, or the CurrentReflectionContext ALC.
With this current behavior im having a hard time not having to include the NuGet.Frameworks.dll published, where it needs to be the same version as the NuGet.Frameworks.dll in the dotnet SDK.
Steps to Reproduce
Have ie. ProjectCreator nuget package or other assemblies that depends on Nuget.Frameworks dll.
Use BuildManager In-Proc to restore projects.
If published version dont match as the one in the SDK, theres file load failures.
Have the ability to load the Nuget.Frameworks dll in the Default ALC or CurrentReflectionContext should help
Expected Behavior
NuGet.Frameworks.dll is loaded correctly, either as part as the MSBuild Locator, or in a more controlled ALC setup.
Actual Behavior
NuGet.Frameworks.dll needs to be published, and need to match exact dll version as the dotnet sdk, making it hard on dev machines as dotnet sdk is tied to the local installed version.
Analysis
No response
Versions & Configurations
No response
The text was updated successfully, but these errors were encountered: