Dim
Dim

Reputation: 4837

Create single Exe file from WPF project

Is it possible to create single exe file from my C# WPF project? The project contains some images and videos in Movies folder inside bin.

How can I compile all of this in singe exe file? I know it will be large in size but it is OK.

Upvotes: 2

Views: 5680

Answers (1)

Anatoliy Nikolaev
Anatoliy Nikolaev

Reputation: 22702

You should add this files to you project and use Build Action: Resource for this files. In this case, it will be introduced into the main assembly of application.

It will be a binary resource, because it is embedded in the compiled assembly as an opaque binary large object.

Quote from Matthew MacDonald book: Pro WPF 4.5 in C#:

There are a couple of things that you must not do in order to use assembly resources successfully:

  • Don’t make the mistake of setting the Build Action property to Embedded Resource. Even though all assembly resources are embedded resources by definition, the Embedded Resource build action places the binary data in another area where it’s more difficult to access. In WPF applications, it’s assumed that you always use a build type of Resource.

  • Don’t use the Resources tab in the Project Properties window. WPF does not support this type of resource URI.

Upvotes: 2

Related Questions