Create a WPF Application
Create a WPF Application
In this post, we take a quick look at how to create and setup a WPF application using Visual Studio. So, if VS is your preferred editor, this post if for you!
Join the DZone community and get the full member experience.Join For Free
Learn how error monitoring with Sentry closes the gap between the product team and your customers. With Sentry, you can focus on what you do best: building and scaling software that makes your users’ lives better.
In this article, we will see how we can create and set up a WPF Application.
Visual Studio 2015
Microsoft Visual Studio 2015 Installer Projects, which be download here.
Setting Up a WPF Project
Start by creating a new WPF project. You’ll learn more by going through the steps yourself.
Choose the WPF Application project under Visual C# in the New Project dialog.
Setting Up a Setup Project
After this is done, add a new Setup Project under Visual Studio Installer in the New Project dialog.
Now we will add the project's primary output into the Setup Project. To do so, go through the following steps: Setup Project-->Right Click--> View--> File System.
All applications need to copy one or more files onto the target computer.
Visual Studio's .NET Setup Project File System view lets you choose which files will be installed and where they will be stored (and found) in the File System view in a normal Setup project.
This is your Destination folder where you're going to install or copy the entire application (config file, icon, .exe), so you can add all your project files here.
AlwaysCreate = True
This folder is your desktop, you can put a shortcut to the application file here.
Now create a desktop shortcut.
Primary Output-->Right Click-->Create Shortcut to Primary output from WpfApplication.
Format - .ico
Size - 50px, 50px
Now set a shortcut icon.
After creating a shortcut, go to the properties. we have many options, including an icon. Now pick an icon from the local system and set it.
User’s Program Menus
This folder is about your start menu. You can put a shortcut to the application file here.
AddRemoveProgramsIcon - To set an icon to uninstall the program icon.
Author - Set Author Name.
Manufacturer - Set Company Name.
ProductName - Set Product Name.
Target Platform - Choose your Target Platform (x86 or x64)
When we develop an application using any platform, we should prepare our application to be deployed properly.
Now, I will explain how to add the framework to be installed before our application installation process.
Select the .NET Framework 4.5 tick box after selecting 'Create setup program to install prerequisite components.'
The final step. Rebuild your setup project.
I hope this has helped you to better understand how to create an MSI setup in WPF.
Opinions expressed by DZone contributors are their own.