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.

.net core SDK 2.1.4 generates projects that can't build

See original GitHub issue

I’ve been unsuccessfully trying to create a new project. The newly created project fails to restore and build. This happens both through VS 15.5.6 and through the command line. For simplicity, let’s focus on the command line:

BTW, I repaired, uninstalled and installed both dotnet-sdk-2.1.4-win-x64.exe and dotnet-sdk-2.1.4-win-gs-x64.exe, all to no help.

It looks like the generated .csproj has incorrect versions:

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

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.1</TargetFramework>
    <RuntimeFrameworkVersion>2.1.0-preview1-25929-02</RuntimeFrameworkVersion>
    <NETStandardImplicitPackageVersion>2.1.0-preview1-25929-02</NETStandardImplicitPackageVersion>
  </PropertyGroup>

</Project>

Steps to reproduce

dotnet new console

Expected behavior

New project is created, restored and ready to build

Actual behavior

The template "Console Application" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on C:\src\sterling\sterling.csproj...
  Restoring packages for C:\src\sterling\sterling.csproj...
C:\src\sterling\sterling.csproj : error NU1102: Unable to find package Microsoft.NETCore.App with version (>= 2.1.0-preview1-25929-02)
C:\src\sterling\sterling.csproj : error NU1102:   - Found 23 version(s) in nuget.org [ Nearest version: 2.0.5 ]
C:\src\sterling\sterling.csproj : error NU1102:   - Found 0 version(s) in Microsoft Visual Studio Offline Packages

Environment data

dotnet --info output:

.NET Command Line Tools (2.2.0-preview1-007622)

Product Information:
 Version:            2.2.0-preview1-007622
 Commit SHA-1 hash:  045e2b7bf7

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.16299
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.2.0-preview1-007622\

Microsoft .NET Core Shared Framework Host

  Version  : 2.1.0-preview1-25929-02
  Build    : 328fbf0657c4e3bab243460660583c429eaae001

Workaround

The project restores, builds and runs if I follow the warning and set both RuntimeFrameworkVersion and NETStandardImplicitPackageVersion to 2.0.5.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
livarcocccommented, Feb 6, 2018

@dasMulli is correct in his comments above! Thanks for getting to this issue.

@AmadeusW we do not have the 2.2.0 not 2.1.300 previews going out with any version of VS. So, the Roslyn build is your asnwer above as to how you got that version of the SDK in your system.

I can’t answer as to when Roslyn will update their SDK. cc @jaredpar for that.

Also, if fails to restore because while working with the preview, we recommend adding nuget feeds to the created projects pointing to locations in myget where the preview nuget packages can be found. We have a bug tracking updating our preview documentation to document which feeds to add.

Hope this helps. If there is still anything wrong, just comment and we can help/re-activate this issue.

0reactions
AmadeusWcommented, Feb 5, 2018

I just noticed that building [Roslyn[(http://github.com/dotnet/roslyn) makes you install 2.2.0 SDK - I guess that’s how I ended up with this version:

D:\src\roslyn\build\Targets\Imports.targets(433,5): error : The 2.2.0 SDK is required to build this repo. It can be install here https://dotnetcli.blob.core.windows.net/dotnet/Sdk/2.2.0-preview1-007622/dotnet-sdk-2.2.0-preview1-007622-win-x64.exe [D:\sr c\roslyn\src\Compilers\Core\CodeAnalysisTest\CodeAnalysisTest.csproj]

Should Roslyn update their requirement to 2.1.300?

Read more comments on GitHub >

github_iconTop Results From Across the Web

The current .NET SDK does not support targeting . ...
Visual studio allowed me to create a new project for Core 2.2, but it was showing the error: "The current .NET SDK does...
Read more >
Cannot create ASP.NET Core 2.1 project
I have installed .NET Core 2.1 (dotnet --version returns 2.1.4) and newest Visual Studio 2017 (15.5.7) but the newest version of ASP.NET Core...
Read more >
NETSDK1045: The current .NET SDK does not support ...
This error occurs when the build tools can't find the version of the .NET SDK that's needed to build a project. This is...
Read more >
Visual Studio 2019 unable to locate .Net Core SDK
Step 1) First run dotnet --list-sdks from the command line (as in Grzegorz Smulko's answer). Take note of the greatest version number.
Read more >
.NET core vs .NET framework
Microsoft maintains both runtimes for building applications with .NET while sharing many of the same APIs. This shared API is called the .NET...
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