Guten Tag,
ich versuche eine simple Hello World .NET Core Anwendung mit crossgen nativ zu kompilieren. Dazu bin ich folgendem Tutorial gefolgt:
.NET Core Application Deployment:
https://docs.microsoft.com/en-us/dotnet/articles/core/deploying/index#crossgen
Ich habe das Projekt "foo" angelegt und einen release build für win81-x64 mit dotnet publish erzeugt. Nun ist die foo.exe aber noch MSIL und ich möchte sie wie beschrieben mit crossgen nativ kompilieren. Allerdings steht in dem Artikel weder wo ich crossgen finde, noch wie ich es benutze.
Mit der Windows 8.1 Suchfunktion habe ich eine crossgen.exe in
C:\Users%USERNAME%.nuget\packages\runtime.win7-x64.Microsoft.NETCore.Runtime.CoreCLR\1.0.2\tools\
gefunden. Ist es das richtige Programm? Wie benutze ich es richtig? Ich habe einige Sachen über die Konsole versucht, aber ohne Erfolg.
Mfg,
PsyPath
Hallo,
schau mal hier bei GitHub, da steht eigentlich alles: Using CrossGen to Create Native Images
Und ja, die crossgen.exe die Du gefunden hast, solltest Du verwenden können.
Gruß, MarsStein
Non quia difficilia sunt, non audemus, sed quia non audemus, difficilia sunt! - Seneca
.NET Core via Native ist nicht wirklich fertig.
Es soll Bestandteil der dotnet.exe CLI werden, sodass Du via dotnet build <target> --native
(bzw. vorher dotnet compile <target> --native
)arbeiten kannst.
Das war auch im RC so enthalten, wurde der CLI mit RTM aber entfernt.
Siehe auch dotnet compile - no matching command
- performance is a feature -
Microsoft MVP - @Website - @AzureStuttgart - github.com/BenjaminAbt - Sustainable Code
Danke für deine Antwort. Dem Artikel bin ich ebenfalls gefolgt. Hier mal meine Ansätze (bat Datei):
Mit publish\foo.exe:
C:\Users\%USERNAME%\Desktop\foo\bin\release\netcoreapp1.0\win81-x64\publish\crossgen.exe /Platform_Assemblies_Paths "C:\Users\%USERNAME%\Desktop\foo\bin\release\netcoreapp1.0\win81-x64\publish" foo.exe
pause
Als Konsolenausgabe erhalte ich:
Microsoft (R) CoreCLR Native Image Generator - Version 4.5.22220.0
Copyright (c) Microsoft Corporation. All rights reserved.
Error compiling foo.exe: The image being compiled is not a .NET assembly (Except
ion from HRESULT: 0x80131F0B)
Error: compilation failed for "foo.exe" (0x80131f0b)
Mit publish\foo.dll:
C:\Users\%USERNAME%\Desktop\foo\bin\release\netcoreapp1.0\win81-x64\publish\crossgen.exe /Platform_Assemblies_Paths "C:\Users\%USERNAME%\Desktop\foo\bin\release\netcoreapp1.0\win81-x64\publish" foo.dll
pause
Als Konsolenausgabe erhalte ich:
Microsoft (R) CoreCLR Native Image Generator - Version 4.5.22220.0
Copyright (c) Microsoft Corporation. All rights reserved.
Error compiling foo.dll: The image being compiled is not a .NET assembly (Except
ion from HRESULT: 0x80131F0B)
Error: compilation failed for "foo.dll" (0x80131f0b)
Laut dotPeek ist foo.exe tatsächlich keine .NET assembly, foo.dll hingegen aber schon. In foo.dll steht mein programmierter Hello World Code.
Was mache ich falsch?
Ich vertrau dotPeek hier noch nicht so ganz.
Meine .NET Core dll erkennt er als .NET Framework 4.6.2, was definitiv nicht der Fall ist 😉
- performance is a feature -
Microsoft MVP - @Website - @AzureStuttgart - github.com/BenjaminAbt - Sustainable Code
Ja, das ist wohl richtig. Wollte damit hauptsächlich sagen, das die foo.dll definitiv keine native dll ist, da ich den Code mit dotPeek lesen kann.
Also konnte der RC in Sachen native mehr? Kann man sich den noch irgendwo runterladen?