eljamba
eljamba

Reputation: 385

Create a standalone exe file in Visual Studio 2019

I would like to create an exe file from my WPF project which can work without other project files and which can be ran on different computers. Currently, I'm using the Publish function in Build > Publish ProjectName, with these options:

Profile name: FolderProfile
Delete existing files: false
Configuration: Release | Any Cpu
Target framework: net5.0-windows
Deployment mode: Framework-dependent
Target runtime: Portable
Target Location: \bin\Release\net5.0-windows\publish\

Even if successfully published, I found various files in the target location and when I copied the exe in a different folder, externally to the project folder, it didn't work and no window appeared.

Any suggestion? Thank you!

Upvotes: 5

Views: 33220

Answers (1)

Hui Liu
Hui Liu

Reputation: 1078

You could try the following steps:

  1. Right-click on the project and select Publish.
  2. Choose the location you want to deploy, as an example, I choose the folder, and then next->finish. enter image description here
  3. Click Edit, set Deployment Mode to Self-contained, expand File publish options, and select Produce single file. enter image description here

Upvotes: 6

Related Questions