-
-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to publish AOT? #43
Comments
Question. Are you have .NET 7 SDK installed? I have 7.0.100-rc.2.22452.3 (and previously version was working fine) and everything was working. Are you have either |
My SDK is 6.0.400 and I'm building the winforms sample project, I've now added |
I think this is your answer. dotnet/runtime#61231 (comment) or maybe slightly earlier for context. For now .NET 6 SDK a bit broken. You can either use specific version of ILCompiler or wait for NET 6 SDK to land fix, or install NET 7 preview |
How can I use a specific version of the ILCompiler? |
Try
|
With this I get: |
NativeAOT does not support .NET 6, so I probably would limit my attempts here too. Let me know if you still need this. |
Yeah it works fine with .NET 7. But it is normal that the output files are extremely huge in release mode? And that there are still many other files in the output directory? For a console project a get a rather small app with only one executable. |
native dll which is in the output dir you most likely can ignore. They are coming from WPF and that's SDK issue. Probbaly nobody bother with this yet. Minimal size of output EXE is limited to the fact that WinForms is using reflection a lot, Control is very fat class. Not sure what can be done to this, but this is mostly related to WinForms code. |
Yeah I was talking about all of these:
and so on. There are 21 additional files with a total size of 21mb. |
Not quite clear why do you have 21 additional files. If they are from your external libs, probably you need them.
Other files, I never seen them. I assume we did not count PDB files, they are not required obviously. |
I dont count PDB file. It is a simple "hello world" Winforms app with no other external lib / dependency than WinFormsComInterop. Deleting all code reduces it to 17 additiona files. <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net7.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<PlatformTarget>x64</PlatformTarget>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PublishAot>true</PublishAot>
<_SuppressWinFormsTrimError>true</_SuppressWinFormsTrimError>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="WinFormsComInterop" Version="0.3.2" />
</ItemGroup>
</Project> Project file: //edit: I just moved only the executable into a new folder and it runs. So maybe all of the additional files can be deleted. I however havent tried running the executable on a system without any SDK / runtime / VC++ redis installed. |
What command do you use for publish? |
Can you run just |
do you have |
I've attached the project file above, yes I have. |
hey bro. i can build winform native oat but i click button and it notifi errors ************** Exception Text ************** ************** Loaded Assemblies **************
|
@NCLnclNCL can you show what's in your |
|
If I publish the sample app, I still get a managed .NET dll file with an executable host file and all the .NET runtime dll files. But when I publish a console project with AOT I get a single unmanaged executable. This is what I've expected for Winforms as well.
I used this command
dotnet publish -r win-x64
and then went to thepublish
folder.The text was updated successfully, but these errors were encountered: