Reputation: 63
I am using Visual Studio 2019 with C# 8.0 and my project is based on this sample: https://github.com/dotnet/corert/tree/master/samples/HelloWorld
When I open a command prompt and navigate in my solution folder I use the following command to compile in native code:
dotnet publish -c release -r win-x64
This works great.
However compiling/building in Visual Studio 2019 (and not using cmd) won't generate the native code. In the output window there is no step "Generating native code".
Here is my .csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<AssemblyVersion>1.0.1234</AssemblyVersion>
<TargetFramework>netcoreapp3.0</TargetFramework>
<Platforms>x64</Platforms>
<DebugType>none</DebugType>
<DebugSymbols>false</DebugSymbols>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.DotNet.ILCompiler" Version="1.0.0-alpha-*" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
</ItemGroup>
</Project>
Upvotes: 2
Views: 3965
Reputation: 12089
You can publish it in the post-build event without re-compilation
dotnet publish --no-build --no-restore /p:NativeLib=Shared -r win-x64 -c release
Upvotes: 0