.net core 找不到Microsoft.NETCore.Native.targets

.net core 找不到Microsoft.NETCore.Native.targets,.net-core,visual-studio-2017,.net-core-rc2,.net Core,Visual Studio 2017,.net Core Rc2,我正试着去做 我做到了: dotnet新控制台 网络构建 将csproj更改为 <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>netcoreapp1.0</TargetFramework> </PropertyGroup> <Import Project="$(MSBuildSDKsPath)\Microsoft.NET.Sdk\S

我正试着去做

我做到了:

  • dotnet新控制台
  • 网络构建
  • 将csproj更改为

    <PropertyGroup>
      <OutputType>Exe</OutputType>
      <TargetFramework>netcoreapp1.0</TargetFramework>
    </PropertyGroup>
    
    <Import Project="$(MSBuildSDKsPath)\Microsoft.NET.Sdk\Sdk\Sdk.targets" />
    <Import Project="$(IlcPath)\Microsoft.NETCore.Native.targets" />
    

    我在VS2017中使用了x64本机工具命令提示符

    我的设置:

    dotnet--info.NET命令行工具(2.0.0-preview2-006080)

    产品信息:版本:2.0.0-preview2-006080 提交SHA-1哈希:0a89053574

    运行时环境:操作系统名称:Windows操作系统版本:10.0.15063 操作系统平台:Windows RID:win10-x64基本路径:C:\Program Files\dotnet\sdk\2.0.0-preview2-006080\

    Microsoft.NET核心共享框架主机

    版本:2.0.0-preview2-25309-07内部版本: 41f5fc94eedc889f086800c23f35bf14a8c75a9f


    这个Microsoft.NETCore.Native.targets怎么样?它似乎是一种特殊的占位符。如何修复上述错误?

    IlcPath
    是指设置为CoreRT生成的输出(
    C:\path\u to\u your\CoreRT\bin\Product\Windows\NT.x64.Debug\packaging\publish1
    ),而不是您自己的应用程序。您需要克隆并构建CoreRT才能正常工作。

    您是否使用VS 2017的预览版本?否。Visual Studio Enterprise 2017 15.2(26430.6)我认为您需要.net core 2.0的预览版本才能正常工作。我也安装了该版本。显然,安装程序的文件名是dotnet-dev-win-x64.2.0.0-preview1-005977.exe
    dotnet--version
    prints 2.0.0-preview2-006080
    Microsoft (R) Build Engine version 15.3.117.23532
    Copyright (C) Microsoft Corporation. All rights reserved.
    
    C:\Users\Documents\Visual Studio 2017\Projects\testproject\testproject.csproj(9,3): error MSB4019: The imported project "C:\Users\Documents\Visual Studio 2017\Projects\testproject\bin\Debug\netcoreapp1.0\Microsoft.NETCore.Native.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
    
    Build FAILED.
    
    C:\Users\Documents\Visual Studio 2017\Projects\testproject\testproject.csproj(9,3): error MSB4019: The imported project "C:\Users\Documents\Visual Studio 2017\Projects\testproject\bin\Debug\netcoreapp1.0\Microsoft.NETCore.Native.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
        0 Warning(s)
        1 Error(s)
    
    Time Elapsed 00:00:00.17