I need to do an installer for a local web application developed in ASP.NET. How can I do a MSI installer to automatically deploy on IIS the application?
2 Answers
The WiX toolset (http://wixtoolset.org/) has great support for IIS Website installers. Here's a randomly selected and arbitrary tutorial to get you started; http://blog.bartdemeyer.be/2013/10/create-an-installer-for-website-with-wix-part-1/
Comments
FWIW, IsWiX project templates (VS2012+) excel at this story. Here is a rough outline:
Install Windows Installer XML and Industrial Strength Windows Installer XML
Use the VS project templates to create an ASP.NET Web Application Solution
Name: BookStore
Location: C:\Source\BookStore
Solution Name: Application
Check Create directory for solution
Select Single Page Application and click OK
Right click the BookStore project in the solution explorer and select Publish
Click Custom and enter the name LocalDeploy and click OK
Select the FileSystem publish method
Enter ....\Installer\Deploy and click Publish
Close the solution
Use the VS project templates to create a Windows Installer XML \ IsWiX Solution (.MSI/.MSM) solution
Name: BookStore
Location: C:\Source\BookStore
Solution Name: Installer
Check Create directory for solution
Double click the BookStoreMM.wxs in the solution explorer.
Select Tools | IsWiX AddIn
Click Files and Folders
Drag and drop the files and folders you want to deploy from the source view to the destination view
Click Save and close IsWiX
Click Yes when prompted by Visual Studio to reload the source. Take a look at the XML written by IsWiX.
Right click references in the BookStoreMM project and add a reference to WixIIsExtension.dll
Double click the BookStoreMMcustom.wxs in the BookStoreMM project.
Select Tools | IsWiX AddIn
Click Namespaces
Select the iis namespace
Click Save and close IsWiX
Click Yes when prompted by Visual Studio to reload the source. Take a look at the XML written by IsWiX.
Author a website component under the DirectoryRef element and add a ComponentRef element to the ComponentGroup element. The exact elements and attributes will depend on the specific IIS needs of your application. Here is a general sample.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:iis="http://schemas.microsoft.com/wix/IIsExtension">
<Fragment>
<!-- Reference Custom Components Below -->
<ComponentGroup Id="Custom">
<ComponentRef Id="webHomePage"/>
</ComponentGroup>
<!-- Author Custom Components Below -->
<DirectoryRef Id="MergeRedirectFolder">
<Component Id="webHomePage" Guid="someguid" KeyPath="yes">
<iis:WebSite Id="default" SiteId="*" Description="HomePage" Directory="MergeRedirectFolder" ConfigureIfExists="no">
<iis:WebAddress Id="AllUnassigned" Port="80" />
<iis:WebDirProperties Id="webDirPropsApi" AnonymousAccess="yes" WindowsAuthentication="no"/>
</iis:WebSite>
</Component>
</DirectoryRef>
</Fragment>
</Wix>