Experimental project aiming at making it possible to use .NET Native with CoreRT's ILCompiler and MSVC's link.exe
instead of Bartok/Triton MDIL Compiler of nutc_driver.exe
and rhbind.exe
.
Currently only the x64 target is tested and confirmed to be working, but support for x86 and ARM32 is planned.
Note
.NET Native already uses CoreRT's ILCompiler for the ARM64 target (codenamed ProjectX) unlike for the x86, x64, and ARM32 targets so you don't need this project for ARM64 targets.
Note
Usage guide below is temporary until a proper installation method is there.
-
Compile
bootstrap
,bootstrap_dll
,shimAppDll
, andshimExe
on theRelease
configuration. -
Copy the compiled
.lib
s to .NET Native's Nuget package ilctools
folder (.nuget\runtime.win10-x64.microsoft.net.native.compiler.2.2.12-rel-31116-00\tools\x64\ilc\tools
). -
Download
mrt100X_app.lib
to .NET Native's Nuget package ilc runtime libs folder (.nuget\runtime.win10-x64.microsoft.net.native.compiler.2.2.12-rel-31116-00\tools\x64\ilc\Lib\Runtime
). -
Duplicate
mrt100_app.dll
and name the duplicated copymrt100X_app.dll
. -
Copy
ILCompiler.Compiler.dll
,ILCompiler.DependencyAnalysisFramework.dll
,ILCompiler.Host.dll
,ILCompiler.MetadataTransform.dll
, andILCompiler.TypeSystem.dll
from arm64 ilc tools folder to x64 ilc tools folder (.nuget\runtime.win10-arm64.microsoft.net.native.compiler.2.2.12-rel-31116-00\tools\arm64\ilc\tools
->.nuget\runtime.win10-x64.microsoft.net.native.compiler.2.2.12-rel-31116-00\tools\x64\ilc\tools
). -
Open
ILCompiler.Host.dll
in dnSpy, then navigate toILCompilerHost.AddTocModule
, thenEdit Method
, then replaceFile.OpenRead(filename)
withFile.OpenRead(filename.Replace("win10-x64", "win10-arm64"))
, thenCompile
, and finallyFile
>Save Module
. -
Add this to your app's csproj (tweak the paths as needed)
<UseDotNetNativeSharedAssemblyFrameworkPackage>false</UseDotNetNativeSharedAssemblyFrameworkPackage>
<IlcParameters>/PureNative /LinkPath:"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.38.33130\bin\Hostx64\x64" /NativeLibPath:"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22621.0\um\x64"</IlcParameters>
- Profit!