简体   繁体   中英

Microsoft.NETCore.Native.targets was not found

I'm trying to " Compiling source to native code using the ILCompiler ".

I did:

  1. dotnet new console
  2. dotnet build
  3. Changed the csproj to

     <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" /> 

    1. set IlcPath=C:\\Users\\Documents\\Visual Studio 2017\\Projects\\testproject\\bin\\Debug\\netcoreapp1.0
    2. dotnet build
 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 

I used the x64 NAtive Tools Command PRompt for VS 2017

My Setup:

dotnet --info .NET Command Line Tools (2.0.0-preview2-006080)

Product Information: Version: 2.0.0-preview2-006080 Commit SHA-1 hash: 0a89053574

Runtime Environment: OS Name: Windows OS Version: 10.0.15063 OS Platform: Windows RID: win10-x64 Base Path: C:\\Program Files\\dotnet\\sdk\\2.0.0-preview2-006080\\

Microsoft .NET Core Shared Framework Host

Version : 2.0.0-preview2-25309-07 Build : 41f5fc94eedc889f086800c23f35bf14a8c75a9f

Whats about this Microsoft.NETCore.Native.targets? It seems to be a kind of a special placeholder. How can I fix the above error?

IlcPath is mean to be set to the output of a build of CoreRT ( C:\\path_to_your\\corert\\bin\\Product\\Windows_NT.x64.Debug\\packaging\\publish1 ) and not your own app. You'll need to clone and build CoreRT for this to work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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