0
votes

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?

1
Are you using the preview version of VS 2017?Ken Tucker
No. Visual Studio Enterprise 2017 15.2 (26430.6)Briefkasten
I think you need the preview version for .net core 2.0 to work properly microsoft.com/net/core/preview#windowscmdKen Tucker
I have installed that too. Obviously the filename of the setup is dotnet-dev-win-x64.2.0.0-preview1-005977.exe dotnet --version prints 2.0.0-preview2-006080Briefkasten

1 Answers

0
votes

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.