Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Create a WPF Application

DZone's Guide to

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!

· Web Dev Zone ·
Free Resource

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.

Introduction

In this article, we will see how we can create and set up a WPF Application.

Prerequisites

  • 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.

Image title

Setting Up a Setup Project

After this is done, add a new Setup Project under Visual Studio Installer in the New Project dialog.

Image title

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.

Application Folder

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.

  • Application Folder-->Add-->PrimaryOutput.

Image title

Image title

  • AlwaysCreate = True

Image title


User’s Desktop

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.Image title

Icon

  • 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.

Image title

User’s Program Menus

This folder is about your start menu. You can put a shortcut to the application file here.

Setup Properties

  1. AddRemoveProgramsIcon - To set an icon to uninstall the program icon.

  2. Author - Set Author Name.

  3. Manufacturer - Set Company Name.

  4. ProductName - Set Product Name.

  5. Target Platform - Choose your Target Platform (x86 or x64)

Image title

Setup Prerequisites

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.'

Image title

Output

The final step. Rebuild your setup project.

Image title

Image title

Conclusion

I hope this has helped you to better understand how to create an MSI setup in WPF.

What’s the best way to boost the efficiency of your product team and ship with confidence? Check out this ebook to learn how Sentry's real-time error monitoring helps developers stay in their workflow to fix bugs before the user even knows there’s a problem.

Topics:
msi ,wpf application ,web dev

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}