I highly recommend looking at Wix #. See http://www.codeproject.com/Articles/31407/Wix-WixSharp-managed-interface-for-WiX .
Also see CodePlex Home Page: http://wixsharp.codeplex.com/
For developers, primarily coding in C #, Wix # is likely to be the easiest and most convenient set of skills to add, and it is free and integrates directly with Visual Studio. I used it with great success in Visual Studio 2012 and 2013.
For C # developers who want to create a Windows Installer MSI to deploy their application, Wix # is arguably the best replacement for the Packaging and Deployment project type that Microsoft has removed from Visual Studio since VS2012. Wix is the C # interface for the WiX (Windows Installer Xml) toolkit. Using Wix # allows you to create a complete Windows Installer MSI in C #.
Wix # is useful for a wide range of installation / deployment scenarios and is well suited for continuous integration scenarios. There are Wix # examples for deploying Windows desktop applications, for installing Windows services, and installing ASP.NET websites and many other types of installations.
Wix # handles typical installer requirements, and the Wix # installer code for simple projects is really simple. For applications that are more complex and require advanced features, Wix # can, if necessary, use the entire set of WiX Toolset. For example, when installing a .NET application, a typical requirement would be to install the application exe and dll files, as well as configure some .NET configuration files and / or registry entries on the target system.
The following is an example C # code for a simple Wix # installer that installs an application on the target system and modifies some configuration files. This example assumes that you wrote a utility called "TailorMyConfig.exe", for example, a simple C # program that uses the ConfigurationManager.AppSettings procedures, and you deploy this exe along with your application.
using System; using System.Windows.Forms; using System.Diagnostics; using Microsoft.Deployment.WindowsInstaller; using WixSharp; class Script { static public void Main(string[] args) { var project = new Project("MyProduct", new Dir(@"%ProgramFiles%\My Company\My Product", new File(@"Files\Bin\MyApp.exe"), new File(@"Files\Bin\TailorMyConfig.exe")), new ManagedAction("UpdateConfigFile")); project.Id = new Guid("6f330b47-2577-43ad-9095-1861ba25889b"); Compiler.BuildMsi(project); } } public class MyCustomAction { [CustomAction] public static ActionResult UpdateConfigFile(Session session) { if (DialogResult.Yes == MessageBox.Show("Config file update ready to run.\n Update config file(s) now?", "Config Tailoring Utility", MessageBoxButtons.YesNo)) { Process.Start("TailorMyConfig.exe", "Run utility to tailor config file to current system"); } return ActionResult.Success; } }
Please note that there are “best” ways to modify the configuration file using WiX XML features. For simplicity, the above example suggested a special C # exe utility for modifying configuration files. I would suggest using WiX XML features for this. You can incorporate virtually any WiX XML feature directly into your Wix # setup using Wix # "XML injection" technology.
Remember that Wix # is just a C # interface that emits WiX XML syntax. After Wix # has released the WiX XML file (wxs file), this wxs file can be easily processed to insert additional WiX XML features. Then the resulting wxs file is compiled using the WiX toolkit in MSI.
For an example of using XML Injection to include WiX XML features in a Wix # (C #) installation, see here In Wix #, how do I avoid creating a physical folder on the target when deploying only registry entries? In this question, see My answer, which uses the delegate connection method to the "WixSourceGenerated" event.
You can then use this XML embedding approach to insert some WiX XML into your installer, which will edit the configuration file. Typical WiX XML Example for Modifying Configuration Files: How to modify .NET configuration files during installation?
Another typical installer requirement is to add or modify Windows registry entries on the target system. Wix # provides direct support for this using the "RegValue" class. The advantage is that when using Wix # you also get the full “uninstall option” for free, including deleting / restoring registry entries to the state of preset. This is a natural result of creating Wix # on top of WiX Toolset technology and Windows Installer. An example of the Wix # registry installer is only here: In Wix #, how to avoid creating a physical folder on the target system when deploying only registry entries?
The Wix # approach was very useful in my environment, and it allows you to use the familiar C # skillset without having to jump forward to the full complexity of the WiX XML installer technology.
The first accepted answer defended this approach:
One good strategy is to use InstallShield LE as a simple container and then make the most of your authorship on WiX. I describe this pattern here my blog: http://blog.iswix.com/2011/01/augmenting-installshield-using-windows_19.html
Although this is a great and workable approach, the approach I propose here has the following advantages:
ADVANTAGES OF USING WIX # PLUS WiX APPROACH
- No need to deal with InstallShield LE or any other proprietary installation product
- The completeness of most installers is written in C # code, a familiar set of skills
- No need to learn the entire WiX toolkit environment; you can start with C # code and then add advanced WiX features as needed using XML Injection.
- This approach will work well in continuous integration environments, with all components that have provided themselves for XCopy deployment will be installed on the build servers, and all components will be highly suitable for automation using scripts such as Powershell scripts.
- If Microsoft changes the AGAIN course to the installer tools bundled with Visual Studio, you will not be affected.
ELEMENTS COMMON WITH LE + WIX
- Built on top of the WiX Toolset features, all WiX XML features can be included in the installer.
- Many excellent "practical solutions" for WiX deployment solutions are available in SO and elsewhere.
- Creates authentic Windows MSI installers, complete with removal features and all the great features of this technology.
- You want to learn more about WiX and Windows Installer technologies when creating installers. Advanced features often require migration to WiX XML.
- Both are integrated more or less easily into Visual Studio. (Anyway, the Wix # approach would have a slight advantage)
So, while the other approach is a workable solution, I recommend Wix # + WiX Toolset as the path of least exacerbation, in the future, for VS2012, VS2013, VS201x. Perhaps the biggest advantage is that you are unlikely to ever have to change the underlying deployment technologies and come back to being blinded by Microsoft again, no matter what Microsoft marketing departments offer to enable or bring deployment technology out of Visual Studio.