Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
AmadeusW opened this issue Feb 4, 2018 · 5 comments
Closed

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

AmadeusW opened this issue Feb 4, 2018 · 5 comments

Comments

@AmadeusW
Copy link

AmadeusW commented Feb 4, 2018

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.

@dasMulli
Copy link
Contributor

dasMulli commented Feb 4, 2018

It looks like you have a 2.2.0 preview SDK version installed at C:\Program Files\dotnet\sdk\2.2.0-preview1-007622\.
Uninstall this version (or just delete the folder). The 2.2,0 previews have been renamed to 2.1.300 so that the major and minor numbers align with the .NET Core runtime they ship with.

@AmadeusW
Copy link
Author

AmadeusW commented Feb 5, 2018

Is this a one-off issue where 2.2.0 was renamed to 2.1.300?

If not, I'm trying to figure out how did my system end up in this configuration:

  • Whether I installed a standalone 2.2.0 preview SDK, or installed it through Visual Studio, why did it stop working? I just updated VS to 15.5.6 - could it have overwritten SDK?
  • Is it expected that updating VS from a preview version to a non preview version will break things?
  • How come VS installer doesn't specify which version of .net core SDK gets installed?

@dasMulli
Copy link
Contributor

dasMulli commented Feb 5, 2018

unfortunately, all 2.2.0 preview versions have to be uninstalled because the version downgrade is a breaking change. this affects everyone who downloaded and installed a CI build. I'm not sure but I don't think any preview VS installed a 2.2.0-preview CLI version..

SDK installs are side-by-side so it will always choose the latest one, even preview versions, unless there is a global.json pinning a specific version.

Personally I don't know why it stopped working. maybe the templates emitted specific versions and not relied on the bundled version properties or your local nuget cache / fallback folder have been deleted.
@livarcocc might know.

@AmadeusW
Copy link
Author

AmadeusW commented 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?

@livarcocc
Copy link
Contributor

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

AmadeusW referenced this issue in AmadeusW/roslyn Feb 7, 2018
The hard link points to a specific version of .NET SDK installer which causes user's machine to end up in a bad state: see [dotnet/cli/issues/8531] and [this](dotnet/designs#29 (comment))

This PR changes the link to the general download page, where user will get a correct and supported version of the SDK
@msftgits msftgits transferred this issue from dotnet/cli Jan 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants