Some time ago I wrote about how to package a .Net Winform application in a one-self contained file. I also tested how was to migrated a Net 4.8 project to Net 5 and it was super easy. I was reading the notes about the new .Net 6. Preview 1 and I got stuck in this sentence.
In .NET 6, single file apps have been enabled for Windows and macOS. In .NET 5, single files apps were limited to Linux. In .NET 6, for all supported operating systems, you can publish a single-file binary that has exactly one file on disk and does not need to extract any of the core runtime assemblies to temporary directories.
This is super cool, now we have this feature available for Windows!
So, I went back to my test project and made a few changes
1st change, set the target framework to use Net 6
Then I created a publish profile using folder as destination location.
And I set the following values in the Profile Settings
Now it was time to publish, and I find my single file ready to use !
This is super cool, however the previous configuration is Framework Dependent. Let’s change the settings for Self Contained.
I got more files !
And it makes sense. The official doc explains this.
There are cases where a single file app will have more than one file. WPF native dependencies are not part of the superhost, resulting in additional files beside the single file app. The same is true for any other native binaries that you happen to depend on.
- Packaging my WinForm OpenCV and Net5 app in a one-self contained file
- Migrating a fully functional Windows Form app to Net 5 in 10 minutes !
- Announcing .NET 6 Preview 1
¿Con ganas de ponerte al día?
En Lemoncode te ofrecemos formación online impartida por profesionales que se baten el cobre en consultoría:
- Si tienes ganas de ponerte al día con Front End (ES6, Typescript, React, Angular, Vuejs…) te recomendamos nuestros Máster Front End: https://lemoncode.net/master-frontend#inicio-banner
- Si te quieres poner al día en Backend (stacks .net y nodejs), te aconsejamos nuestro Bootcamp Backend: https://lemoncode.net/bootcamp-backend#bootcamp-backend/banner
- Y si tienes ganas de meterte con Docker, Kubernetes, CI/CD…, tenemos nuestro Bootcamp Devops: https://lemoncode.net/bootcamp-devops#bootcamp-devops/inicio