-
Notifications
You must be signed in to change notification settings - Fork 171
Unable to load projects on .NET SDK 6.0.301 due to NuGet.Frameworks load errors #1470
Comments
@ricardo-espinoza Could you take a look at this? |
I just tested and #1467 seems to resolve this. With the current Quantum SDK release (0.24.210930), I see the same behavior reported in dotnet/sdk#26065. But testing on the branch |
That PR looks like it would resolve the issue for now, but I would expect it to come back again with other SDK version updates. In my opinion (and that of other MSBuild team members), the correct fix long term is to update your PackageReference with |
Thanks for that suggestion, @baronfel. Could you share what that means to folks such as me who aren't msbuild gods? (That is, what does setting that option do?) |
@ricardo-espinoza I double checked and saw an NuGet.ProjectModel dependency doesn't seem to have the exclude. Could you please update this and confirm the functionality? Thanks |
This is the fun stuff :D The reference for 'dependency assets' in general is here, and for this scenario, we're mainly interested in two kinds of dependency asset:
When you add a
When you add a For apps that operate almost on a plugin model, where some external host dictates the versions of dependencies, we want to use the following semantics: 'compile against a known, potentially lower version of dependency X, but don't include any of the runtime assets for X because my hosting/execution environment will provide the actual DLL'. The way you express this in This is what we tell MSBuild Task authors to do, too - because their task will operate entirely inside an MSBuild context, they should mark their MSBuild PackageReference in this way. Your situation is just one step further - because the .NET SDK also includes the same dependency on NuGet that you're trying to use in your library. Does that help? |
FWIW what we did to address the same problem in OmniSharp, is we delete Nuget.* libraries from the release build prior to packaging https://github.com/OmniSharp/omnisharp-roslyn/blob/master/build.cake#L599-L603 and then simply let them be loaded from the discovered SDK |
@baronfel, |
Thanks all for the pointers and recommendations. With the change mentioned by Andrés, we have addressed the blocking issue reported by @baronfel. We have unfortunately disabled the Language Server tests temporarily, and we're actively working on bringing them back up by addressing this dependency in them too. For now marking the issue as closed. The update will be reflected in the next QDK release. |
The NuGet.* libraries should not be bundled with csharprepl and we should instead use the ones included in the SDK. You can see other projects in the .NET community making similar fixes: microsoft/qsharp-compiler#1470 OmniSharp/omnisharp-roslyn#2308 OmniSharp/omnisharp-roslyn#2436 If we don't do this, we get issues with the MSBuildWorkspaces and MSBuildLocators unable to load the nuget libraries due to dependency conflicts. It mostly affects our "load solution" / "load project" features.
The NuGet.* libraries should not be bundled with csharprepl and we should instead use the ones included in the SDK. You can see other projects in the .NET community making similar fixes: microsoft/qsharp-compiler#1470 OmniSharp/omnisharp-roslyn#2308 OmniSharp/omnisharp-roslyn#2436 If we don't do this, we get issues with the MSBuildWorkspaces and MSBuildLocators unable to load the nuget libraries due to dependency conflicts. It mostly affects our "load solution" / "load project" features.
The NuGet.* libraries should not be bundled with csharprepl and we should instead use the ones included in the SDK. You can see other projects in the .NET community making similar fixes: microsoft/qsharp-compiler#1470 OmniSharp/omnisharp-roslyn#2308 OmniSharp/omnisharp-roslyn#2436 If we don't do this, we get issues with the MSBuildWorkspaces and MSBuildLocators unable to load the nuget libraries due to dependency conflicts. It mostly affects our "load solution" / "load project" features.
Describe the bug
The language server extension bundles a version of NuGet dlls that is incompatible with the ones shipped in the SDK. Because MSbuild Locator is used to locate and run MSBuild DLLs from the SDK, there are version mismatches that lead to errors running targets in the build.
This was initially reported at dotnet/sdk#26065, with detailed resolution steps here.
To Reproduce
Please see the linked issue for reproduction steps.
Expected behavior
The language server should be able to load projects.
System information
Additional context
The short form of the resolution is that the NuGet.Frameworks PackageReference in the LanguageServer should be marked
ExcludeAssets="runtime"
.The text was updated successfully, but these errors were encountered: