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.

Incorrect sdk selected

See original GitHub issue

Steps to reproduce

Create a new dotnet app from CLI

D:\>mkdir a & cd a

D:\a>dotnet new webapp
The template "ASP.NET Core Web App" was created successfully.
This template contains technologies from parties other than Microsoft, see https://aka.ms/aspnetcore-template-3pn-210 for details.

Processing post-creation actions...
Running 'dotnet restore' on D:\a\a.csproj...
C:\Program Files\dotnet\sdk\2.1.104\sdks\Microsoft.NET.Sdk\build\Microsoft.NET.TargetFrameworkInference.targets(135,5): error : The current .NET SDK d
oes not support targeting .NET Core 2.2.  Either target .NET Core 2.0 or lower, or use a version of the .NET SDK that supports .NET Core 2.2. [D:\a\a.
csproj]

Restore failed.
Post action failed.
Description: Restore NuGet packages required by this project.
Manual instructions: Run 'dotnet restore'

Expected behavior

Should work just fine; there is no global.json in D:\

Actual behavior

Reports missing SDK

Environment data

`dotnet --info` output:
D:\>dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   2.2.104
 Commit:    73f036d4ac

Runtime Environment:
 OS Name:     Windows
 OS Version:  6.3.9600
 OS Platform: Windows
 RID:         win81-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.2.104\

Host (useful for support):
  Version: 2.2.2
  Commit:  a4fd7b2c84

.NET Core SDKs installed:
  2.1.104 [C:\Program Files\dotnet\sdk]
  2.1.200 [C:\Program Files\dotnet\sdk]
  2.1.201 [C:\Program Files\dotnet\sdk]
  2.1.202 [C:\Program Files\dotnet\sdk]
  2.2.101 [C:\Program Files\dotnet\sdk]
  2.2.104 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

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

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
livarcocccommented, Feb 24, 2019

I don’t think that’s documented and you are welcome to file an issue on microsoft/docs for that.

I don’t expect many people should be setting this though, if at all. Note that this is not the same as a global.json resolution. The .NET Core SDK hive that was resolved depends on the global.json. If you don’t set this env var, the sdk props/targets are resolved next to the .NET Core SDK.

However, if you set that env var, then props/targets are going to be found based on that location. At this point in time, I don’t believe this would be a change we would make, given all the other things we are working on.

I will take this as a data point though, if we see this more often, we will consider additional logging.

1reaction
livarcocccommented, Feb 24, 2019

@aateeque do you, by any chance, have MSBuildSDKsPath environment variable set and pointing to your 2.1.104 SDK? That would explain why we were using props/targets from that location instead of from the latest SDK.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I "select Android SDK" in Android Studio?
Press " ⌘ + Shift + A" on Mac (or "Ctrl+Shift+A" on Windows ) and in the pop-up EditText, write "Sync Project with...
Read more >
Different Ways to Fix “Select Android SDK” Error in ...
Different Ways to Fix “Select Android SDK” Error in Android Studio · Sync your project with Gradle files · Step 1: Opening project...
Read more >
SDK Path wrong | Apple Developer Forums
3. Go to the Search Paths section of the build settings, and check that an explicit reference to the SDK hasn't been added...
Read more >
STUDIO_SDK_LOC references wrong SDK and cannot be ...
The project is configured to use SDK version 2.4. It looks like the incorrect version reference may be coming from the STUDIO_SDK_LOC path ......
Read more >
NETSDK1045: The current .NET SDK does not support ...
Open the Solution Properties window (ctrl-click the solution in the Solution window and select Properties), select Build - General, and uncheck ...
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