How can I customize an MSI in the Visual Studio setup/deployment project?
Question:
I am using the Visual Studio setup/deployment project to create an MSI to install my application. I would like to add some functionality to this MSI that does not appear to be supported in the Visual Studio IDE (such as modifying the default install path based on a registry value on the system). I know how to do this by directly editing the MSI, but I don't want to have to manually edit the MSI each time I build. Are there any other options I can use in this scenario?
Answer:
There is a limited set of customizations you can make to an MSI in the Visual Studio IDE UI for a setup/deployment project. By limited, I mean that there are a lot of features that are natively supported in Windows Installer MSI format that are not exposed for customization in the Visual Studio IDE. Examples include changing the default install path based on a registry value, advanced setup UI features such as updated banner text or a "launch my product" checkbox on the final screen, creating custom actions that reference external executable files, or setting various custom action attributes (among other things).
If you would like to automate the ability to customize an MSI that is built by the Visual Studio setup/deployment project in a way that is not currently supported by the UI in the Visual Studio IDE, you can write a script that accesses the Windows Installer object model to perform these customizations. Then you can create a post-build step in your Visual Studio setup/deployment project to run your script after the MSI has been built so that the final result each time you build will be an MSI package with your additional customizations made to it.
As an example, you can use the sample script at this location to add a checkbox to your MSI's setup UI that will let the user choose whether or not to launch your product after setup finishes.
If you would like to include this script as a post-build step in a Visual Studio setup/deployment project, you can use the following steps:
- Download the sample script and extract the contents to the directory that contains the Visual Studio project you are working on
- Open the project in Visual Studio
- Press F4 to display the Properties window
- Click on the name of your setup/deployment project in the Solution Explorer
- Click on the PostBuildEvent item in the Properties window to cause a button labeled "..." to appear
- Click on the "..." button to display the Post-build Event Command Line dialog
- Add the following command line in the Post-build event command line text box:
cscript.exe "$(ProjectDir)EnableLaunchApplication.js" "$(BuiltOutputPath)" - Build your project in Visual Studio
Note that the quotation marks in the command line in step 5 are very important because the script will not work correctly without them. Make sure to double-check that you have put quotes in the proper places.
You can find another example script that will update the MSI setup UI banner text in this MSDN forum post.
Recent Posts
- Understanding API First Strategy and Benefits
- Frankenstein APIs Explained! - API Cyber Security Series
- API Security 101 - Cyber Security Explained
- API Trends 2022 - API Security and Cybersecurity
- API Trends 2022 - Seamless Integration Solutions
- API Trends 2022 - Adaptive API Management
- API Trends 2022 - API Integration Automation
- API Trends 2022 - Industry Specific Breakouts
- API Trends 2022 - API Best Practices
- API Trends 2022 - Open API Standards
- API Trends 2022 - API Integration Experience
- API Trends 2022 - API-Led Modernization
- API Trends 2022 - API Economy Growth
- Brenton House - Give your App and APIs a Turbo Boost – Part 2
- Easily Enable Speech Recognition in Titanium iOS using Hyperloop
Tag Cloud
- .NET
- adaptive api management
- android
- api
- api automation
- api best practices
- api economy
- api experience
- api first
- api integration
- api integrations
- api management
- api security
- api standards
- api strategy
- api trends
- apis
- appcelerator
- automation
- boot
- Brenton House
- C#
- Cisco VPN
- Cloud
- Community News
- Continuous Integration
- crash
- cybersecurity
- Dropbox
- fhir apis
- Free Stuff
- General Software Development
- Google Drive
- graphql
- healthcare apis
- houserules
- hyperloop
- ios
- json schema
- Live Mesh
- Mac OS X
- Microsoft
- mobile
- mobile api
- native
- open banking
- openapi
- Other Stuff
- SkyDrive
- speech
- Stuff
- swagger
- Team Systems
- titanium native
- titanium turbo
- Unit Testing
- Vista
- Visual Studio
- Visual Studio 11
- voice
- win7
- Windows 7
- Windows 8
- windows update