45

Just downloaded and installed SDK Net 7.0.100 and it broke existing applications and they won't load any more in VS 2022 or Rider.

Copied the follwing error:

error  : SDK Resolver Failure: "The SDK resolver "Microsoft.DotNet.MSBuildSdkResolver" 
failed while attempting to resolve the SDK "Microsoft.NET.Sdk". Exception: "Microsoft.NET.Sdk.WorkloadManifestReader.WorkloadManifestCompositionException: Workload definition 'wasm-tools' in manifest 'microsoft.net.workload.mono.toolchain.net7' [C:\Program Files\dotnet\sdk-manifests\7.0.100\microsoft.net.workload.mono.toolchain.net7\WorkloadManifest.json] conflicts with manifest 'microsoft.net.workload.mono.toolchain' [C:\Program Files\dotnet\sdk-manifests\7.0.100\microsoft.net.workload.mono.toolchain\WorkloadManifest.json]
   at Microsoft.NET.Sdk.WorkloadManifestReader.WorkloadResolver.ComposeWorkloadManifests()
   at Microsoft.NET.Sdk.WorkloadManifestReader.WorkloadResolver.Create(IWorkloadManifestProvider manifestProvider, String dotnetRootPath, String sdkVersion, String userProfileDir)
   at Microsoft.NET.Sdk.WorkloadMSBuildSdkResolver.CachingWorkloadResolver.Resolve(String sdkReferenceName, String dotnetRootPath, String sdkVersion, String userProfileDir)
   at Microsoft.DotNet.MSBuildSdkResolver.DotNetMSBuildSdkResolver.Resolve(SdkReference sdkReference, SdkResolverContext context, SdkResultFactory factory)
   at Microsoft.Build.BackEnd.SdkResolution.SdkResolverService.TryResolveSdkUsingSpecifiedResolvers(IList`1 resolvers, Int32 submissionId, SdkReference 
Usitha Indeewara
  • 870
  • 3
  • 10
  • 21
David
  • 583
  • 1
  • 4
  • 6
  • Try a clean build. When changing Net version the compiler doesn't recognize changes and net and you may still have intermediate obj files that were compiled with old net version. – jdweng Nov 08 '22 at 18:35
  • 2
    @jdweng it won't help, it's not a build issue, this manifests are conflicting indeed, they do not depend on build – YMC Nov 09 '22 at 03:49
  • @ymc : Deleting all the directories like you stated is a clean build. In some cases the automatic updates in Net fail. Then you have to manually delete the reference to library in Solution Explorer and add again so the version of the library gets updated. What I said will help. I understand the issue very well. – jdweng Nov 09 '22 at 09:53
  • https://developercommunity.visualstudio.com/t/I-am-unable-to-load-new-projects/10194566 – Joseph Wambura Nov 09 '22 at 11:06

11 Answers11

40

I experienced a similar problem. I uninstalled the 7.0.100-preview.5.22307.18 sdk using add remove programs and then changed the TargetFramework in the project file to use 7.0 and then I was able to load the projects.

Tim Farley
  • 509
  • 3
  • 3
  • 4
    I kind of took half the advice, I uninstalled 7.0.100 using add/remove then installed the lastest 6.0 SDK, https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-6.0.403-windows-x64-installer And for me that worked, thanks. – David Nov 08 '22 at 20:10
  • 6
    I didn't even have to change the target framework. Just uninstalling 7.0.100-preview made my project load. Wow! do I love searching my error message and finding an SO question that was asked and answered teh same day I had the error!! – Tim Nov 08 '22 at 21:34
  • You all will see this problem when you update VS 2022 to the lastest version, after I got it working using above, I updated VS 2022 to lastest version and the problem reappeared. – David Nov 08 '22 at 21:38
  • 4
    I just uninstalled the preview version of .Net 7 and it works for me. My projects were targeting .Net 6 SDK. – Manish Bhalodi Nov 09 '22 at 06:50
  • For mac users: In VS for Mac Preferences/SDK Locations/.NET Core/SDK and Runtimes you can use the "Full uninstall.." button and then download and install sdks again. It worked for me. – JanB Nov 09 '22 at 12:23
  • 1
    On MacOs: I just deleted the whole dotnet folder sudo rm -rf /usr/local/share/dotnet and installed .net 7 again. Then it worked – Marco Nov 09 '22 at 15:09
32

EDIT: This is officially documented in the release notes known issues.

I'm from the .NET SDK team. Sorry you're going through this. I would love to comment on the other answers, but I don't have the reputation to do so.

What Tim Farley suggested is an officially endorsed workaround; uninstalling any preview 7 SDKs with add/remove programs should resolve the problem. As for why this happened and why uninstalling preview SDKs will fix the issue, there's a bit of an explanation I put here: https://github.com/dotnet/sdk/issues/28947#issuecomment-1307987337. TLDR: Some workloads were renamed in the middle of .NET 7 preview development to support things like multitargeting, and when you download the new RTM old preview files interfere can with it.

Updating the TargetFramework is recommended but it's unrelated to this issue. Usually breaking changes for each .NET version and related new features are gated behind your TargetFramework (TFM), so things don't break until you update the TFM, not when you update the SDK. (Unfortunately, not true in this case.)

In response to whether this will happen again or not when upgrading to .NET 8, per Scott: with how workloads are currently structured this issue would happen again. We're discussing how to make changes to prevent this from happening again though as it's not ideal. We're also considering adding dotnet workload clean or something to repair this for you. Communicating with us on the SDK GH thread, or with me here, is a good way to send us feedback about this.

nagilson
  • 329
  • 1
  • 5
  • this would be nice, the command to clean it up – Joseph Wambura Nov 09 '22 at 19:07
  • Having wasted a few hours on this today, if none of the other solutions work, the post from walterlv in the github link finally sorted this out for me. – Robbie Dee Nov 09 '22 at 22:24
  • Frankly, .NET workloads should be removed. It is overthought/overengineered. I understand why they are there, but EVERY release they just cause problems. I have 2/3 development workstations "bricked", where I have no idea why projects just stopped working. I have used .NET 7 preview 1 -> RC2 perfectly OK...RTM drops and everything just breaks. It has been a mess since .NET 5. – Bart Czernicki Nov 12 '22 at 23:49
  • Just wasted two working hours to find a fix for yet another Microsoft screw-up :p – Egil Hansen Nov 14 '22 at 07:47
12

Repairing Visual Studio installation did not help me. Neither did uninstalling .NET 7 faulty workload ('wasm-tools'), since any attempt to uninstall or repair it ended up in the same error message.

enter image description here

Being ran out of conventional options to address the issue, I just went ahead and physically deleted the conflicting folder: microsoft.net.workload.mono.toolchain, leaving second one microsoft.net.workload.mono.toolchain.net7 intact. It luckily solved problems on my machine. From now on I'll be more cautious on installing Ms RC packages

Guru Stron
  • 102,774
  • 10
  • 95
  • 132
YMC
  • 4,925
  • 7
  • 53
  • 83
8

I had a similar problem, even on new .NET projects. I uninstalled the 7.0.100-preview.2.22153.17 SDK using add remove programs and I was able to create a new project again. I am now left with only one .NET 7.0 SDK (from Visual Studio) as shown below.

enter image description here

Guru Stron
  • 102,774
  • 10
  • 95
  • 132
Joseph Wambura
  • 2,732
  • 2
  • 21
  • 24
4

Uninstall Microsoft .Net SDK 7.0 preview

0

I had the same issue as above except on my M1 mac. I followed the following guide and manually removed all the directories for all the .net 7 runtimes and sdks. Then reinstalled .net7 and all seems to be well now. rider can open my projects and the dotnet cli no longer complains

Not sure if a similar scorched earth approach will work for the windows folks.

https://devkimchi.com/2021/11/24/removing-dotnet-sdks-from-macos-manually/

0

I had the same issue, except that no preview version of .NET 7 was currently installed on my system, but the preview artifacts were still in the C:\Program Files\dotnet\sdk-manifests\7.0.100 directory. My solution was to uninstall the stable version of .NET 7 (not the version from VS 2022), then install and uninstall 7.0.100-preview.7. Doing so resulted in the preview artifacts being removed and this error being resolved.

breadswonders
  • 41
  • 1
  • 6
0

I had same problem, but i think the problem because M1 mac

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 30 '22 at 18:25
0

Had the same problem. Deleted manually installed net 7 sdks in windows uninstaller.

0

I found out that I needed to rm -rf **/obj (delete all folders named obj) in the solution root folder after upgrading from net 6 to net 7, in addition to dotnet clean

Gaël James
  • 157
  • 13
0

I faced the SDK resolver problem after updating my visual studio 2022 enterprise. The problem was that a MSBuildSDKsPath variable was added to the Environment Variables after the update. I deleted it and deleted the same from registry and now I no longer get the resolver error.

codredd
  • 21
  • 3