Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Deploy WPF application using MSI

Tags:

deployment

wpf

I have a WPF C# desktop application that will need to be deployed as MSI (Windows Installer deployment, not ClickOnce deployment) in VS2010. My application will generate SQL CE database in run-time, manipulate Excel Workbook, and receive/transmit data from/to COM Port - so I don't know what is the appropriate way to deploy such an application.

I am looking at Windows Installer Deployment Tasks which doesn't help me to get started.

Could anyone show me some resources that give instructions on how to deploy an application as an MSI installer?

like image 605
KMC Avatar asked Aug 01 '26 01:08

KMC


2 Answers

If you don't want ClickOnce, then you'll probably need to create your own MSI. In that case, you can use:

  1. The built-in Setup project type in Visual Studio. It does a decent job but has limitations. Works very well if you don't have many dependencies or custom actions.
  2. A commercial tool like InstallShield
  3. WIX (Windows Installer XML)

I've tried both 1 and 3. While WIX has a little bit of a learning curve, it is a very rich way to do what you want to do. There is a fair bit of documentation available and some very nice "out of the box" wizard sequences to handle your standard install scenarios (licenses, feature selection, dependencies, etc). WIX does have some VS integration that works quite well.

You can find out more on WIX at http://wix.sourceforge.net/

Note: The VS setup project can do custom actions, and install dependencies, but you have to use custom actions. If you want to parameterize the custom actions, then you'll need to find the not-so-intuitive instructions on that topic.

The other limitation of the VS setup project is that the setup project can only be compiled to an MSI by VS (devenv.exe). That means that the MSI cannot be compiled on a build server unless you install Visual Studio there too. This was a show stopper for me, so I switched to WIX and was very happy with the result.

like image 198
NathanAW Avatar answered Aug 07 '26 23:08

NathanAW


For those like me who found this post after searching high and low for how to deploy an MSI these days, you now need an extension as the visual studio team removed the built in startup project functionality. You now need to download the Visual Studio Installer Projects extension.

See this user voice post for discussion of the removal, and here is a link to the extension.

Useful for people looking for a quick solution to generating an MSI through Visual Studio rather than getting deep into Wix (although if you need more advanced deployment options, definitely go that route).

like image 26
alaskanloops Avatar answered Aug 07 '26 22:08

alaskanloops



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!