libgit2sharp: Can't load projects in solution

Reproduction steps

I followed the instructions in CONTRIBUTING.md and installed the required .NET Core SDK and runtimes by running tools\Install-DotNetSdk.ps1 (I tried both with and without -InstallLocality Machine).

CONTRIBUTING.md mentions to use buildandtest.cmd to build and run the tests. I can’t find that file anywhere.

Trying to open LibGit2Sharp.sln in Visual Studio 2019 (or Jetbrains Rider) fails to load the projects with:

15-04-2020 14:18:36	Critical	Some of the projects might not be read correctly. You may disable solution loading from disk or do that for certain projects.|   
Project 'LibGit2Sharp' load failed:
	[MSB4236] The SDK 'Microsoft.NET.Sdk' specified could not be found.  D:\Develop\libgit2sharp\LibGit2Sharp\LibGit2Sharp.csproj at (0:0)Project 'LibGit2Sharp.Tests' load failed:
	[MSB4236] The SDK 'Microsoft.NET.Sdk' specified could not be found.  D:\Develop\libgit2sharp\LibGit2Sharp.Tests\LibGit2Sharp.Tests.csproj at (0:0)Project 'NativeLibraryLoadTestApp.x86' load failed:
	[MSB4236] The SDK 'Microsoft.NET.Sdk' specified could not be found.  D:\Develop\libgit2sharp\NativeLibraryLoadTestApp\x86\NativeLibraryLoadTestApp.x86.csproj at (0:0)Project 'NativeLibraryLoadTestApp.x64' load failed:
	[MSB4236] The SDK 'Microsoft.NET.Sdk' specified could not be found.  D:\Develop\libgit2sharp\NativeLibraryLoadTestApp\x64\NativeLibraryLoadTestApp.x64.csproj at (0:0)

Deleting global.json allowed me to load the projects.

Version of LibGit2Sharp (release number or SHA1)

master branch: 4de700fedf87a5c9de10b921a636cc2f21d8964d

Operating system(s) tested; .NET runtime tested

Windows 10

Output of dotnet --info:

A compatible installed .NET Core SDK for global.json version [3.1.100] from [d:\Develop\libgit2sharp\global.json] was not found
Install the [3.1.100] .NET Core SDK or update [d:\Develop\libgit2sharp\global.json] with an installed .NET Core SDK:
  2.1.301 [C:\Program Files (x86)\dotnet\sdk]

Host (useful for support):
  Version: 3.1.3
  Commit:  4a9f85e9f8

.NET Core SDKs installed:
  2.1.301 [C:\Program Files (x86)\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.1 [C:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.1 [C:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.3 [C:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.1 [C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.3 [C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.3 [C:\Program Files (x86)\dotnet\shared\Microsoft.WindowsDesktop.App]

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

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (11 by maintainers)

Most upvoted comments

I’ve never met a VS version that couldn’t load all prior SDK versions.

Just to make the point, I took a clone of https://github.com/aarnott/library.template, changed global.json from 3.1.201 to 2.1.513, and removed the netcoreapp3.1 target from the test app (since .NET SDK 2.1 can’t target .NET Runtime 3.1). I then ran init.ps1 -installLocality repo and then opened the solution from that same window. VS came right up with all the projects opened.

Interesting. That’s definitely not what I would have expected based on everything I’ve read. I was under the impression that both VS and the SDK had minimum versions it would work with. Thanks for the new information!

Seems like something that should be clarified somewhere. Being able to point to a document that says that VS can work with all older SDKs would be nice.