简体   繁体   English

netcoreapp2.0 和 netstandard2.0

[英]netcoreapp2.0 with netstandard2.0

I have a project(x) that targets the NetStandard.Library 2.0 and a console app that targets netcoreapp2.0.我有一个面向 NetStandard.Library 2.0 的项目(x)和一个面向 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: 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.项目 x 与 netcoreapp2.0 (.NETCoreApp,Version=v2.0) / win-x86 不兼容。 Project x supports: netstandard2.0 (.NETStandard,Version=v2.0)项目 x 支持: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.我已安装:Microsoft net core 2.0.0 运行时位于此处: https : //github.com/dotnet/core-setup但它仍然无法构建。

*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. *编辑了以下建议:我已经安装了位于此处的 Alpha SDK: https : //github.com/dotnet/cli/tree/master#installers-and-binaries ,但我仍然遇到相同的错误。

在此处输入图片说明

The interesting thing is that there is a nuget package reference for Microsoft.NETCore.App which I cannot remove:有趣的是,我无法删除 Microsoft.NETCore.App 的 nuget 包参考: 在此处输入图片说明

.NET Core 2.0 will require the .NET Core 2.0 SDK. .NET Core 2.0 将需要 .NET Core 2.0 SDK。 Download links to nightlies are available here: https://github.com/dotnet/cli/tree/master#installers-and-binaries可在此处获得 nightlies 的下载链接: 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.截至 2017 年 2 月,.NET Core 2.0 尚未公开发布。 Checkout https://github.com/dotnet/corefx/blob/master/Documentation/project-docs/dogfooding.md for instructions on using nightlies.查看https://github.com/dotnet/corefx/blob/master/Documentation/project-docs/dogfooding.md以获取有关使用 nightlies 的说明。

.NET Core 2.0 SDK (final release) is available including tools for vs 2017 /2015. .NET Core 2.0 SDK(最终版本)可用,包括用于 vs 2017 /2015 的工具。

You can download and it's integrated with vs 2017.3您可以下载并与vs 2017.3集成

Note that if you installed this version: dotnet-sdk-2.0.0-win-gs-x64 , it didn't show in visual studio 2017.3, ref请注意,如果你安装了这个版本: DOTNET-SDK-2.0.0-双赢GS-64 ,它并没有在Visual Studio 2017.3,显示REF

For feature details read: Announcing .NET Core 2.0有关功能详细信息,请阅读: 宣布 .NET Core 2.0

Also, ASP.NET Core 2.0 is available此外, ASP.NET Core 2.0可用

.NET Core 2.0 is not on the Download page and it is expected to be released in Q2 2017 on the roadmap . .NET Core 2.0 不在下载页面上,预计将于 2017第二季度在路线图上发布。

You should use .NET Core 1.1 and target .NET Standard 1.6 for now.您现在应该使用 .NET Core 1.1 并以 .NET Standard 1.6 为目标。

And yes: you must download the SDK if you want to develop.是的:如果你想开发,你必须下载 SDK。

if you have both Core and DotNet 4.X within the same solution, you may want to consider adding netcoreapp2.0 to your "<\\TargetFramework>" tag.如果您在同一个解决方案中同时拥有 Core 和 DotNet 4.X,您可能需要考虑将 netcoreapp2.0 添加到您的“<\\TargetFramework>”标签中。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM