godot: Mono build fail, error MSB4237: The SDK resolver type "DotNetMSBuildSdkResolver" failed to load [Mono MSBuild]

Godot 3.23 rc5

OS/device including version: Windows 10, x64 Nvidia 1650

Issue description: Using Mono build 6.60.1.66. Using VSCode. No Visual Studio installed. Everything worked in 3.2.2. Created new blank project using rc5. Using settings from working 3.2.2. mono. Clicked build. Got this error:

Project "Test 1.sln" (Restore target(s)):
	Message: Building solution configuration "Debug|Any CPU".
	Project "Test 1.csproj" (Restore target(s)):
		C:\Users\p\Downloads\Godottstrc5\projects\test1\Test 1.csproj(0,0): error MSB4237: The SDK resolver type "DotNetMSBuildSdkResolver" failed to load. The type initializer for 'Microsoft.DotNet.MSBuildSdkResolver.VSSettings' threw an exception. [C:\Users\p\Downloads\Godottstrc5\projects\test1\Test 1.csproj]
	Done building project "Test 1.csproj" -- FAILED.
Done building project "Test 1.sln" -- FAILED.

Steps to reproduce: Just create a new project with RC5. I am using the settings from the previous working build. Other projects I tested also don’t build.

Minimal reproduction project:

test1.zip

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 31 (12 by maintainers)

Most upvoted comments

nuget.config

this solves my problem.

I opened %appdata%\NuGet\NuGet.config it was -

<?xml version="1.0" encoding="utf-8"?>
<configuration />

no after modifying it to -

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
  </packageSources>
</configuration>

It’s start working.

warning : Unable to load the service index for source https://api.nuget.org/v3/index.json.

There seems to be some configuration or network issue on your system. Can you access https://api.nuget.org/v3/index.json from your browser?

You could check your %appdata%\NuGet\NuGet.config.

Or try to create a nuget.config file in your project directory (next to the csproj and sln) with the following contents and see if that changes anything

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
  </packageSources>
</configuration>

Otherwise tou may find more possible solutions googling for Unable to load the service index for source.

warning : Unable to load the service index for source https://api.nuget.org/v3/index.json.

There seems to be some configuration or network issue on your system. Can you access https://api.nuget.org/v3/index.json from your browser?

You could check your %appdata%\NuGet\NuGet.config.

Or try to create a nuget.config file in your project directory (next to the csproj and sln) with the following contents and see if that changes anything

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
  </packageSources>
</configuration>

Otherwise tou may find more possible solutions googling for Unable to load the service index for source.

This fixed my issue. I don’t what happened, but my NuGet.Config file only had the closing tag for configuration and nothing else. Replaced it with what you had and it fixed my error.

My error was:

unable to resolve ‘godot.net.sdk (= 3.3.0)’ for ‘.netstandard,version=v0.0’.

Just tested it with Godot_v3.2.3-rc6_mono_win64 (pre RC6) , also installed dotnetsdk 3.1.401 linked above. Happily, any newly created project works, both with mono & dotnetCLI. Alas, any project created with 3.2.2 stable or even RC5 fails with the same errors as above (error MSB4237 for mono).

@neikeq I have a similar problem with Ubuntu 20.04, .net core 3.1.401 installed that it builds in Godot but not in VSCode. I was also able to fix it by changing to dotnet core cli build. It worked before switching to Godot 3.2.3 RC4 as well.

This seems to be yet another issue with Mono’s MSBuild. I recommend to change it to a different build tool. If this is Godot 3.2.3, then I recommend changing it to dotnet CLI and installing the .NET Core SDK (make sure you download the SDK, not the runtime). The other option is changing it to MSBuild (VS Build Tools) but that requires you to install Visual Studio or Visual Studio Build Tools which is bigger than the .NET Core SDK.

I can reproduce this issue with normal C# projects (using Microsoft.NET.Sdk), so it’s not Godot-specific. Albeit I remember testing the same a few weeks ago and not experiencing this problem, which is weird.