roslyn: Workspace failed with could not load "NuGet.Frameworks" error
Version Used: 4.2.0
Steps to Reproduce:
There’s a sample: https://github.com/WeihanLi/dotnet-exec/blob/c856424abe605ada9f4d2bedb68c3526d1241bc8/src/dotnet-exec/AdvancedCodeCompiler.cs
Expected Behavior:
Should work without error
Actual Behavior:
Failure, Msbuild failed when processing the file 'C:\projects\sources\SamplesInPractice\net7Sample\Net7Sample\Net7Sample.csproj' with message: C:\Program Files\dotnet\sdk\7.0.100-preview.4.22252.9\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets: (90, 5): The "ProcessFrameworkReferences" task failed unexpectedly.
System.IO.FileLoadException: Could not load file or assembly 'NuGet.Frameworks, Version=6.3.0.32, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not find or load a specific file. (0x80131621)
File name: 'NuGet.Frameworks, Version=6.3.0.32, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
---> System.IO.FileLoadException: Could not load file or assembly 'NuGet.Frameworks, Version=6.3.0.32, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
at System.Runtime.Loader.AssemblyLoadContext.<LoadFromPath>g____PInvoke__|5_0(IntPtr ptrNativeAssemblyBinder, UInt16* ilPath, UInt16* niPath, ObjectHandleOnStack retAssembly)
at System.Runtime.Loader.AssemblyLoadContext.LoadFromPath(IntPtr ptrNativeAssemblyBinder, String ilPath, String niPath, ObjectHandleOnStack retAssembly)
at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)
at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingLoad(AssemblyName assemblyName)
at System.Runtime.Loader.AssemblyLoadContext.Resolve(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
at Microsoft.NET.Build.Tasks.ProcessFrameworkReferences.ExecuteCore()
at Microsoft.NET.Build.Tasks.TaskBase.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask)
And I could not find the NuGet.Frameworks
package with version 6.3.0
on the NuGet website, I finally find it in the sdk folder, did I miss some config?
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 27 (24 by maintainers)
Commits related to this issue
- WIP try NuGet.Frameworks FLE workaround https://github.com/dotnet/roslyn/issues/61454#issuecomment-1191209761 — committed to knocte/FSharpLint by knocte 2 years ago
- WIP try NuGet.Frameworks FLE workaround https://github.com/dotnet/roslyn/issues/61454#issuecomment-1191209761 — committed to knocte/FSharpLint by knocte 2 years ago
- WIP try NuGet.Frameworks FLE workaround https://github.com/dotnet/roslyn/issues/61454#issuecomment-1191209761 — committed to knocte/FSharpLint by knocte 2 years ago
- WIP try NuGet.Frameworks FLE workaround https://github.com/dotnet/roslyn/issues/61454#issuecomment-1191209761 — committed to knocte/FSharpLint by knocte 2 years ago
- WIP try NuGet.Frameworks FLE workaround https://github.com/dotnet/roslyn/issues/61454#issuecomment-1191209761 — committed to knocte/FSharpLint by knocte 2 years ago
- WIP try NuGet.Frameworks FLE workaround https://github.com/dotnet/roslyn/issues/61454#issuecomment-1191209761 — committed to knocte/FSharpLint by knocte 2 years ago
- WIP try NuGet.Frameworks FLE workaround https://github.com/dotnet/roslyn/issues/61454#issuecomment-1191209761 — committed to knocte/FSharpLint by knocte 2 years ago
- WIP try NuGet.Frameworks FLE workaround https://github.com/dotnet/roslyn/issues/61454#issuecomment-1191209761 — committed to knocte/FSharpLint by knocte 2 years ago
- WIP try NuGet.Frameworks FLE workaround https://github.com/dotnet/roslyn/issues/61454#issuecomment-1191209761 — committed to knocte/FSharpLint by knocte 2 years ago
- WIP try NuGet.Frameworks FLE workaround https://github.com/dotnet/roslyn/issues/61454#issuecomment-1191209761 — committed to knocte/FSharpLint by knocte 2 years ago
- WIP try NuGet.Frameworks FLE workaround https://github.com/dotnet/roslyn/issues/61454#issuecomment-1191209761 — committed to knocte/FSharpLint by knocte 2 years ago
- WIP try NuGet.Frameworks FLE workaround https://github.com/dotnet/roslyn/issues/61454#issuecomment-1191209761 — committed to knocte/FSharpLint by knocte 2 years ago
- WIP try NuGet.Frameworks FLE workaround https://github.com/dotnet/roslyn/issues/61454#issuecomment-1191209761 — committed to knocte/FSharpLint by knocte 2 years ago
- WIP try NuGet.Frameworks FLE workaround https://github.com/dotnet/roslyn/issues/61454#issuecomment-1191209761 — committed to knocte/FSharpLint by knocte 2 years ago
- WIP try NuGet.Frameworks FLE workaround https://github.com/dotnet/roslyn/issues/61454#issuecomment-1191209761 — committed to knocte/FSharpLint by knocte 2 years ago
- WIP try NuGet.Frameworks FLE workaround https://github.com/dotnet/roslyn/issues/61454#issuecomment-1191209761 — committed to knocte/FSharpLint by knocte 2 years ago
- WIP try NuGet.Frameworks FLE workaround https://github.com/dotnet/roslyn/issues/61454#issuecomment-1191209761 — committed to knocte/FSharpLint by knocte 2 years ago
- Replace NuGet.Frameworks nuget to workaroudn FLE Previous commit adding the nuget reference didn't work. This is a workaround that works: https://github.com/dotnet/roslyn/issues/61454#issuecomment-11... — committed to knocte/FSharpLint by knocte 2 years ago
- Replace NuGet.Frameworks nuget to workaround FLE Previous commit adding the nuget reference didn't work. This is a workaround that works: https://github.com/dotnet/roslyn/issues/61454#issuecomment-11... — committed to knocte/FSharpLint by knocte 2 years ago
- Replace NuGet.Frameworks nuget to workaround FLE Previous commit adding the nuget reference didn't work. This is a workaround that works: https://github.com/dotnet/roslyn/issues/61454#issuecomment-11... — committed to knocte/FSharpLint by knocte 2 years ago
@JoeRobich @carlossanlop Hey, i found workaround, that force roslyn to use sdk’s dll version. There is not so good solution, but it works. In my case i got error after updating sdk to
6.0.302
, whereNuGet.Frameworks 6.2.1.7
is used, that is not exist in nuget, latest nuget version is 6.2.1.2. So i forced to copy sdk’s version of dll to output directory.Thank you, @JoeRobich ! Your suggestion unblocked my problem with the tests.
Edit: Nevermind, it seems to be still there.
I would expect 4.9.0-2.final for the first preview bits.
Yes, that worked! I now get the exact same behavior in both
dotnet test
and Test Explorer. Thank you for the universal workaround, @rainersigwald.Thanks @MelnikovIG! Your suggestion was clever and a good workaround that works for now.
I keep getting broken by this every now and then. It’s quite obnoxious. Would love to see it fixed and prevented in the future.
@carlossanlop I should have noted that the version number in my example above is only for .NET 7 SDK Preview 5. If you have installed the newer Preview 6 SDK, then we would need to find the matching NuGet version.
Sure thing.
The customer’s sample code looks right, at least at first glance. I’ve reached out to the MSBuild team for advice here.