Search code examples
c#.net-corerider

Unable to load solution in JetBrains Rider


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.


Solution

  • 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.