How to build c# UWP-based project to one .exe file

2019-08-11 04:01发布

问题:

I want to use universal windows in my project for windows 10 only. I need to compile all my UI&logic stuff to one exe-file (or dll). Like I could do the same with usual WPF application. But results of build contains a lot of .xbf files and .net-libraries. I already tryed to set "Compile with .NET Native tool chain" options in project's build settings, but the results still contains a lot of files.

回答1:

Within the uwp development framework, there's no such thing as an exe file.

From the MSDN:

Apps are packaged and distributed using the .AppX packaging format.

All UWP apps are distributed as an AppX package. This provides a trustworthy installation mechanism and ensures that your apps can be deployed and updated seamlessly.

This is the same scenario as it was with Windows 8 and Windows 8.1 applications using the WinRT framework.

If you need an exe file just to install your app without going through the store, take a look at the sideloading option for UWP.

You can find more info about creating packages, going through the store and sideloading here.