相关文章推荐

After update of Visual Studio and .NET I got an error that seems to repeat pretty often. Unfortunately I forget how to deal with it every single time.

The issue looks like this

msbuild //works
dotnet build
    Enter fullscreen mode
    Exit fullscreen mode
C:\Program Files\dotnet\sdk\5.0.41\Current\SolutionFile\ImportAfter\Microsoft .NET.Sdk.Solution.targets(14,3): error MSB4619: The imported
project "C:\Program Files\dotnet\sdk\5.6.100\Sdks\Microsoft .NET.Sdk\targets\Microsoft.NET.Sdk.Common.targets" was not found. Confirm that
the expression in the Import declaration "C:\Program Files\dotnet\sdk\5.0.41\Sdks\Microsoft.NET.Sdk\targets\Microsoft .NET.Sdk.Common.targets" is correct, and that the file exists on disk.
Build FAILED.
C:\Program Files\dotnet\sdk\5.0.41\Current\SolutionFile\ImportAfter\Microsoft .NET.Sdk.Solution.targets(14,3): error MSB4619: The imported
project "C:\Program Files\dotnet\sdk\5.6.100\Sdks\Microsoft .NET.Sdk\targets\Microsoft.NET.Sdk.Common.targets" was not found. Confirm that
the expression in the Import declaration "C:\Program Files\dotnet\sdk\5.0.41\Sdks\Microsoft.NET.Sdk\targets\Microsoft .NET.Sdk.Common.targets" is correct, and that the file exists on disk.
    Enter fullscreen mode
    Exit fullscreen mode

The MSBuildSDKsPath variable is important here. It looks like it's looking at the wrong folder.

When I created an enviroment variable with the name MSBuildSDKsPath and value C:\Program Files\dotnet\sdk\5.0.401\Sdks it works!

Don't forget to restart your terminal.

Built on Forem — the open source software that powers DEV and other inclusive communities.

Made with love and Ruby on Rails. DEV Community © 2016 - 2024.

 
推荐文章