Home > Mobile >  Visual Studio for Mac 2022 does not use expected .NET6 SDK
Visual Studio for Mac 2022 does not use expected .NET6 SDK

Time:10-06

I've tried to build a sample TodoApp downloaded on screenshot - console app I can build and launch this basic app.

After that, I've re-created the project TodoAppService.NET6: I can restore the packages and build it.

In Visual Studio, I can see that the latest Microsoft.NETCore.App framework is used: screenshot - created project

But when I open the TodoApp solution in Visual Studio, it seems that the same framework is not recognised, as it appears as a SDK without the version: screenshot - downloaded project

Edit: news tests

I did new tests by adding a global.json file in the TodoAppService.NET6 project of the TodoApp solution:

{
  "sdk": {
    "version": "6.0.401",
    "rollforward": "minor"
  }
}

This didn't change anything and I always has the same error when I try to restore packages...

It's really frustrating and I don't have any other idea to fix this...

CodePudding user response:

Is it possible that you have a mix of .NET and classic projects in our solution, which causes issues with MSBuild on Mono. This stack overflow issue explains the problem

Go to your solution properties, then Build -> General and uncheck 'Build with MSBuild on Mono'. If this is your issue, you should see the project will immediately build after unchecking the box.

  • Related