netcoreapp2.0 with netstandard2.0

Code Junkie picture Code Junkie · Feb 24, 2017 · Viewed 24.3k times · Source

I have a project(x) that targets the NetStandard.Library 2.0 and a console app that targets netcoreapp2.0.

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
  </PropertyGroup>

  <PropertyGroup>
    <PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" />
    <PackageReference Include="Microsoft.AspNetCore" Version="1.1.0" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.1" />
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.0" />
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.0" />
    <PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.1.0" />
    <PackageReference Include="NETStandard.Library" Version="2.0.0-beta-25021-01" />
    <PackageReference Update="Microsoft.NETCore.App" Version="2.0.0-beta-001588-00" />
  </ItemGroup>
  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0-msbuild3-final" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\x.csproj" />
  </ItemGroup>

</Project>

Project X:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.0" />
  </ItemGroup>


  <ItemGroup>
    <PackageReference Update="NETStandard.Library" Version="2.0.0-beta-25017-01" />
  </ItemGroup>
</Project>

When I compile the console application I get the Error:

Project x is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0) / win-x86. Project x supports: netstandard2.0 (.NETStandard,Version=v2.0)

I have installed: Microsoft net core 2.0.0 runtime located here: https://github.com/dotnet/core-setup but it still doesnt build.

*edited following advice from below: I have installed the Alpha SDK located here: https://github.com/dotnet/cli/tree/master#installers-and-binaries and I still get the same error.

enter image description here

The interesting thing is that there is a nuget package reference for Microsoft.NETCore.App which I cannot remove: enter image description here

Answer

natemcmaster picture natemcmaster · Feb 25, 2017

.NET Core 2.0 will require the .NET Core 2.0 SDK. Download links to nightlies are available here: https://github.com/dotnet/cli/tree/master#installers-and-binaries

Heads up: nightly builds of this are very unstable right now. As of February 2017, .NET Core 2.0 has no public release. Checkout https://github.com/dotnet/corefx/blob/master/Documentation/project-docs/dogfooding.md for instructions on using nightlies.