question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't load projects in solution

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
bordingcommented, Apr 16, 2020

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.

0reactions
AArnottcommented, Apr 17, 2020

You rebooted, @ermshiperete? But you only have 2.1.301 installed in the machine location (in your issue description), and this repo required 3.1.100 (until @bording’s PR which bumped it to 3.1.201). So it’s no wonder VS couldn’t load your projects. Had you opened VS immediately from the command prompt you used to install the .NET SDK with our script, it would have worked perfectly.

You must either use -InstallLocality Machine or launch VS from the same command prompt you ran our init script from. And no reboot is necessary.

I don’t have DOTNET_ROOT set. Not successfully installed the SDK machine-wide - that was probably true, but that’s what I thought tools\Install-DotNetSdk.ps1 should have done.

Install-DotNetSdk.ps1 did set the DOTNET_ROOT env var, at least if you installed in a lesser location than Machine. But that env var only is set in the powershell.exe process that ran the script.

Where is running init.ps1 mentioned? Should that be run instead of Install-DotNetSdk.ps1?

init.ps1 just runs Install-DotNetSdk.ps1 and then restores packages. So for your purposes, the two are equivalent.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Visual Studio not showing all Projects in solution
Close the VStudio entire project, go to the main project folder and click on the . · go to solution explorer see which...
Read more >
Visual Studio 2022 Community Project not load solution
Please first try to reboot your machine and directly start VS and open your project, to avoid the impact from other extensions/applications.
Read more >
Cannot load projects - Developer Community
This solution contains 9 netstandard class libs, 5 netcore test projects, 1 aspnetcore and 1 console netcore app. All these projects cannot be...
Read more >
One or More Projects in the solution were not loaded correctly
If you want to fix this types of error then must to update your tools, I face this problem when I was not...
Read more >
VS : How to solve error - The project file could not be ...
The problem lies with the nonexistent path of one or more projects that are stored in the solution file. You can solve this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found