dotnet / msbuild

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
https://docs.microsoft.com/visualstudio/msbuild/msbuild
MIT License
5.23k stars 1.35k forks source link

error : The SDK resolver type "DotNetMSBuildSdkResolver" failed to load. The type initializer for 'Microsoft.DotNet.MSBuildSdkResolver.VSSettings' threw an exception. #4227

Closed mustafaerdogmus closed 5 years ago

mustafaerdogmus commented 5 years ago

Steps to reproduce

Either include a project sample, attach a zipped project, or provide IDE / CLI steps to create the project and repro the behaviour. Example of a project sample:

Project file


  <PropertyGroup>
    <TargetFramework>netcoreapp2.2</TargetFramework>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <DocumentationFile></DocumentationFile>
    <OutputPath></OutputPath>
  </PropertyGroup>

  <ItemGroup>
    <Folder Include="LogFiles\" />
    <Folder Include="wwwroot\" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.App" Version="2.2.0" />
    <PackageReference Include="NetEscapades.Extensions.Logging.RollingFile" Version="1.0.1" />
    <PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
    <PackageReference Include="SyrianBallaS.AutoMapper.Extensions.Microsoft.DependencyInjection.Signed" Version="3.2.0" />
    <PackageReference Include="System.ValueTuple" Version="4.5.0" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\Yetem.Application.Common\Yetem.Application.Common.csproj" />
    <ProjectReference Include="..\Yetem.Application.Data\Yetem.Application.Data.csproj" />
    <ProjectReference Include="..\Yetem.Application.Dto\Yetem.Application.Dto.csproj" />
  </ItemGroup>

</Project>

Dotnet SDK install version

.NET Core SDK (varsa global.json'u yansıtır):
 Version:   2.2.104
 Commit:    73f036d4ac

Çalışma Zamanı Ortamı:
 OS Name:     Windows
 OS Version:  10.0.17763
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.2.104\

Host (useful for support):
  Version: 2.2.2
  Commit:  a4fd7b2c84

.NET Core SDKs installed:
  1.1.9 [C:\Program Files\dotnet\sdk]
  1.1.11 [C:\Program Files\dotnet\sdk]
  1.1.12 [C:\Program Files\dotnet\sdk]
  2.1.4 [C:\Program Files\dotnet\sdk]
  2.1.200 [C:\Program Files\dotnet\sdk]
  2.1.201 [C:\Program Files\dotnet\sdk]
  2.1.202 [C:\Program Files\dotnet\sdk]
  2.1.403 [C:\Program Files\dotnet\sdk]
  2.1.500 [C:\Program Files\dotnet\sdk]
  2.1.502 [C:\Program Files\dotnet\sdk]
  2.1.503 [C:\Program Files\dotnet\sdk]
  2.1.504 [C:\Program Files\dotnet\sdk]
  2.1.600 [C:\Program Files\dotnet\sdk]
  2.2.104 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 1.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 1.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 1.0.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 1.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 1.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 1.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 1.1.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 1.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

Visual Studio install version VS 2017 15.9.8

ERROR: The SDK resolver type "DotNetMSBuildSdkResolver" failed to load. The type initializer for 'Microsoft.DotNet.MSBuildSdkResolver.VSSettings' threw an exception. I get an error.

C:\Users\BIM-ME\source\repos\Yetem\Yetem.Application.Data\Yetem.Application.Data.csproj : error : The SDK resolver type "DotNetMSBuildSdkResolver" failed to load. The type initializer for 'Microsoft.DotNet.MSBuildSdkResolver.VSSettings' threw an exception. C:\Users\BIM-ME\source\repos\Yetem\Yetem.Application.Data\Yetem.Application.Data.csproj

C:\Users\BIM-ME\source\repos\Yetem\Yetem.Application.Dto\Yetem.Application.Dto.csproj : error : The SDK resolver type "DotNetMSBuildSdkResolver" failed to load. The type initializer for 'Microsoft.DotNet.MSBuildSdkResolver.VSSettings' threw an exception. C:\Users\BIM-ME\source\repos\Yetem\Yetem.Application.Dto\Yetem.Application.Dto.csproj

C:\Users\BIM-ME\source\repos\Yetem\Yetem.Application.WebApi\Yetem.Application.WebApi.csproj : error : The SDK resolver type "DotNetMSBuildSdkResolver" failed to load. The type initializer for 'Microsoft.DotNet.MSBuildSdkResolver.VSSettings' threw an exception. C:\Users\BIM-ME\source\repos\Yetem\Yetem.Application.WebApi\Yetem.Application.WebApi.csproj

C:\Users\BIM-ME\source\repos\Yetem\Yetem.Application.Tests\Yetem.Application.Tests.csproj : error : The SDK resolver type "DotNetMSBuildSdkResolver" failed to load. The type initializer for 'Microsoft.DotNet.MSBuildSdkResolver.VSSettings' threw an exception. C:\Users\BIM-ME\source\repos\Yetem\Yetem.Application.Tests\Yetem.Application.Tests.csproj

C:\Users\BIM-ME\source\repos\Yetem\Yetem.Application.Common\Yetem.Application.Common.csproj : error : The SDK resolver type "DotNetMSBuildSdkResolver" failed to load. The type initializer for 'Microsoft.DotNet.MSBuildSdkResolver.VSSettings' threw an exception. C:\Users\BIM-ME\source\repos\Yetem\Yetem.Application.Common\Yetem.Application.Common.csproj

also solution item all project unavaileble

https://i.hizliresim.com/QLnO6A.jpg

rainersigwald commented 5 years ago

Can you describe what you're doing when you see this error? Command line build (what command line?), open in VS, something else?

https://i.hizliresim.com/QLnO6A.jpg

I get a 403 Forbidden on this.

mustafaerdogmus commented 5 years ago

windows 10 operating system gave blue screen error. I did not get the error code. Then I restarted the computer. No microsoft program worked when opened. MS Office, Sql Server, Visual Studio ...

I removed Visual Studio from the computer. I can't say I've removed it smoothly. Then I tried to make clean installation. But it didn't happen.

Then I removed each microsoft program one by one with "YourUninstaller" program. Then I installed office, visual studio, sql server programs. Now I have a seamless development environment

livarcocc commented 5 years ago

This does not seem like the sort of issue that we are going to be able to address, unfortunately. Sounds like your whole machine was in a broken state at the point in time the errors were happening.

kasp1 commented 3 years ago

This happened to me after installing Mono. Looks like Mono has its own compiler called msbuild or something. The path has changed to this Mono one without me knowing it. After uninstalling Mono and manually changing the Path environment variable to the "right" msbuild, this issue was gone.

One probably doesn't have to uninstall Mono, just change the Path env var.

whendon commented 3 years ago

This happened to me after installing Mono. Looks like Mono has its own compiler called msbuild or something. The path has changed to this Mono one without me knowing it. After uninstalling Mono and manually changing the Path environment variable to the "right" msbuild, this issue was gone.

One probably doesn't have to uninstall Mono, just change the Path env var.

Can you elaborate on what the "right" mono build is, and how to check the versions?

kasp1 commented 3 years ago

This happened to me after installing Mono. Looks like Mono has its own compiler called msbuild or something. The path has changed to this Mono one without me knowing it. After uninstalling Mono and manually changing the Path environment variable to the "right" msbuild, this issue was gone. One probably doesn't have to uninstall Mono, just change the Path env var.

Can you elaborate on what the "right" mono build is, and how to check the versions?

Seems like an MSBuild binary comes with both Mono and .NET Framework/Visual Studio installations. My environmental Path exposed the Mono one, which caused the error. (I wrote "right msbuild", not "right mono build")