Blake Rivell
Blake Rivell

Reputation: 13895

Unable to resolve 'Microsoft.NETCore.App (>= 2.0.0)' for '.NETCoreApp,Version=v2.0'

I have tried everything to avoid this error and it keeps coming:

Unable to resolve 'Microsoft.NETCore.App (>= 2.0.0)' for '.NETCoreApp,Version=v2.0'.    

I downloaded and installed everything from this link: https://blogs.msdn.microsoft.com/dotnet/2017/05/10/announcing-net-core-2-0-preview-1/

When I create a new asp.net core project that points to dotnetcore2.0 I get that error.

Why is this?

dotnet --version: 2.0.0-preview2-005905
Here is the csproj file created by the cli or vs2017 template:

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

  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <UserSecretsId>aspnet-SampleProj-FA293BE5-380F-47C2-994D-F7F2FAE390X9</UserSecretsId>
  </PropertyGroup>

  <ItemGroup>
    <Folder Include="wwwroot\" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0-preview1-24647" />
  </ItemGroup>

  <!-- ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0-preview1-24647" />
  </ItemGroup -->

</Project>

Upvotes: 2

Views: 7135

Answers (1)

Dustin Kingen
Dustin Kingen

Reputation: 21275

dotnet --version: 2.0.0-preview2-005905

Preview 2 is the latest .NET Core bits and may not work with the Preview 1 configuration.

To fix this uninstall the nightly bits and installed the .NET Core Preview 1 SDK with VS2017 Preview.

Additionally the ASP.NET and CoreFX teams have published more recent versions of Preview 1 libraries:

2.0.0-preview1-final

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

  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <UserSecretsId>aspnet-SampleProj-FA293BE5-380F-47C2-994D-F7F2FAE390X9</UserSecretsId>
  </PropertyGroup>

  <ItemGroup>
    <Folder Include="wwwroot\" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference
        Include="Microsoft.AspNetCore.All"
        Version="2.0.0-preview1-final" />
  </ItemGroup>

  <!-- ItemGroup>
    <DotNetCliToolReference
        Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools"
        Version="2.0.0-preview1-final" />
  </ItemGroup -->

</Project>

See also:

Upvotes: 2

Related Questions