11

I am attempting to load a solution offered by Pluralsight which contains a project called "GradeBook" using JetBrains' Rider IDE. After cloning the repository from Git and loading the solution, I get an error:

"Project 'GradeBook' load failed: The SDK 'Microsoft.NET.Sdk' specified could not be found. C:\Path\To\RiderProjects\CSharp-GradeBookApplication\GradeBook\GradeBook.csproj at (0:0)"

I checked my local repository and all of the files are present and correct.

The project specifies a target framework version of 2.0.

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <StartupObject />
  </PropertyGroup>

  <ItemGroup>
    <None Remove="*.gdbk" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
  </ItemGroup>

</Project>

I believe my environment supports it as I see it in my list of installed runtimes (Microsoft.NETCore.App 2.0.9). When I run dotnet --info from the command line, I get the following results:

.NET Core SDKs installed:
2.1.202 [C:\Program Files\dotnet\sdk]
2.2.105 [C:\Program Files\dotnet\sdk]
3.0.100-preview3-010431 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0-preview3-19153-02 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0-preview3-27503-5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.0-preview3-27504-2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

I verified Rider is configured to point to the correct path of dotnet.exe:

C:\Program Files\dotnet\dotnet.exe

I have also tried changing the TargetFramework to 2.2 and 3.0 in an effort to bypass this issue.

Being new to C# and .NET, I am sure there are things I have not thought of to troubleshoot this issue. For starters, I do not see a version 2.0 listed under the SDKs, but after installing every .NET SDK I could find, including ones that specifically said they were v2.0, I am out of ideas and need assistance overcoming this issue.

I do know that it is uncommon to use an IDE other than Visual Studio for C# and .NET development, but I see no reason for this simple project to fail to load.

Pang
  • 9,564
  • 146
  • 81
  • 122
John Conde
  • 217,595
  • 99
  • 455
  • 496
  • .NET Core 2.1 includes 2.0 and 2.2 includes 2.1 and 2.0 as well, that's not the problem. Can you create a new project or does that also fail? If you are new to c#, I'd suggest you to use VS rather than Rider, but that's my opinion – Camilo Terevinto Apr 08 '19 at 00:43
  • I have created new projects and they have all worked correctly. Granted, they were very basic projects but they did work. I am using Rider as it is very similar to Jetbrains' PHPStorm which I am *very* familiar with. By using Rider I overcome the hurdle of learning a new IDE and can focus on the coding. – John Conde Apr 08 '19 at 00:47
  • I have VS 2019 with .NET Core 2.1.602 only. I just downloaded that project and it works perfectly fine. It could be related to Rider or to your installation of .NET Core 3.0 preview. Which version is it displayed if you run `dotnet --version`? – Camilo Terevinto Apr 08 '19 at 00:52
  • Running that commands outputs: `3.0.100-preview3-010431` – John Conde Apr 08 '19 at 00:56
  • Try to force the usage of the version 2.2.105 as it shows [here](https://learn.microsoft.com/en-us/dotnet/core/versions/selection#the-sdk-uses-the-latest-installed-version). I wouldn't be amazed if it was a 3.0 preview bug – Camilo Terevinto Apr 08 '19 at 00:59
  • Unsuccessful. I saw that it can be placed anywhere in the file hierarchy and the CLI will search up the project directory structure to find one so I tried placing it in the project root and then the GradeBook directory itself but neither worked. I did doublecheck to make sure I set it to version 2.2.105 as you specified. That seemed promising, though, and thank you for finding that option to try. – John Conde Apr 08 '19 at 01:06
  • I just uninstalled 3.0-preview and now my version is 2.2.105. Same results. It's looking more and more like a Rider issue although it does seem odd for such a simple project. – John Conde Apr 08 '19 at 01:07
  • Hmm, that's weird. Try to compile directly by CD-ing to the .CSPROJ file directory and running `dotnet build` – Camilo Terevinto Apr 08 '19 at 01:12
  • Build succeeded. No errors or warnings. – John Conde Apr 08 '19 at 01:15
  • So it is Rider then. Try restarting your computer, if the problem persists, reconfigure/reinstall Rider (haven't used it, not sure if you have something like a reconfiguration like VS has) and if it still persists... use VS :) – Camilo Terevinto Apr 08 '19 at 01:16
  • 1
    lol. I'll turn it off and then turn it back on and see what happens. :) Maybe someone from Jetbrains will be able to confirm that this is a Rider issue or not. I plan to try it from a second computer tomorrow and see if I get the same results. At least that way i can narrow it down to either Rider or just my current local setup. Thank you for stepping through his with me. It is appreciated. – John Conde Apr 08 '19 at 01:20
  • What Rider version is that? It would help, if you do Help->Compress logs and show in Explorer and post it somewhere. – Ivan Shakhov Apr 08 '19 at 11:33
  • @IvanShakhov I am using version 2018.3.4. I posted my compressed log files [in Dropbox](https://www.dropbox.com/s/b2chtvizd9idfuy/logs-20190408-074628.zip?dl=0) – John Conde Apr 08 '19 at 11:48
  • I just tried this on a second computer and it works perfectly. I was able to determine the difference between the two and will provide an answer so others can learn from my experience. – John Conde Apr 08 '19 at 12:15

3 Answers3

20

The issue boiled down to the MSBuild version I was using. After following the instructions in "Using Rider under Windows without Visual Studio: prerequisites" I had a custom build specified: C:\SDK\MSBuild\15.0\Bin\MSBuild.exe.

enter image description here

I then switched to the autodetected version: C:\ProgramFiles\dotnet\sdk\2.2.105\MSBuild.dll

enter image description here

The project has now loaded successfully.

John Conde
  • 217,595
  • 99
  • 455
  • 496
0

If you are on macOS Ventura (beta?), there seems to be a bug related to file permissions. In Rider, the (.NET 6) solution would not load and Rider was stuck on "Connecting to ReSharper Host".

The solution for me was to chmod -R 777 ~/. I'm sure 777 is more permissive than it needs to be, and it doesn't need to be done on ~/, you probably just need to do it on the directory of the solution you are opening with Rider.

I realize this is a slightly different issue than the question, but this is where I ended up when trying to fix my issue, so others will end up here too.

jspinella
  • 2,013
  • 3
  • 25
  • 39
0

I removed dir .idea, failed

I re-install rider, failed.

I remove the rider config dir, successed.

before this, I exported the setting to setting.zip, then remove the config dir, then import the setting.zip.

scil
  • 169
  • 10