Writing an Installer for ASP.NET Applications Part 1

I’m writing this up in the hopes that it will someday help someone avoid going through what I have for the last several days. I will attempt to describe how to use Visual Studio 2005 to create a Windows Installer msi file that will install asp.net files, create a virtual directory in IIS, make sure that ASP.NET is installed and enabled for IIS, and also make sure that the script mappings for ASP.NET are installed. I’m using C# for coding where needed.

Just to cut to the chase, the real challenge is figuring out and correcting the state of ASP.NET and IIS. Depending on the order of installing IIS and .NET, and probably with some other unknown factors thrown in, IIS may be all set up with ASP.NET and ready to go or it may not have anything from ASP.NET installed at all. ASP.NET may be installed but the script mappings might not be in place, or maybe the script mappings are there. IIS 6.0 adds a twist in that you can have everything installed but the ASP.NET extensions might not be enabled - because, you know, usually when you install something you don’t want to actually be able to use it.

Once it’s all pieced together things don’t seem so bad and all the needed information is out there if you look hard enough. The real challenge for me was figuring out what might go wrong even given some prerequisites. The one thing I haven’t done yet is detect and/or install IIS itself. My code here requires IIS to be installed already, and also assumes IIS 6.0 on Windows Server 2003. It should work the same on XP Pro and maybe others if you take out everything dealing with enabling ASP.NET.

My code, also, is quite possibly not the best way to do this. I am relatively new to .NET and very green when it comes to Windows servers. I had a brief fling with ASP with Access databases back around 1997 or 1998, but since then I’ve been with PHP for a long time, now.

Visual Studio 2005 has a web installer project built in. The nice thing about this is that it takes care of virtual directories for you and all of that. I don’t think you can do much other configuration, though, and I don’t think it checks that ASP.NET is actually configured.

The basic solution configuration I’m using includes:

The deployment project will be modified to collect the desired name for any virtual directories that will be created and then to call into the configuration project with the needed information. When the configuration project runs it will do the following:

  1. Run the normal installation to place the files from the web deployment outputs
  2. Create any virtual directories in IIS pointing to the locations of the installed files
  3. Set the permissions of those files as needed
  4. Ensure that ASP.NET is installed to IIS
  5. Ensure that the ASP.NET script mappings are installed for the virtual directories
  6. Ensure that the ASP.NET extensions are enabled in IIS

This is the end of part 1. Sorry to stop without any of the solution, although just getting this list of things that need to be done was probably the worst part of the whole process.

Extra tags: , ASP.NET, , , .

Published in: ASP.NET, None | on October 20th, 2006 |

You can leave a response, or trackback from your own site.

5 Comments Leave a comment.

  1. On April 20, 2007 at 12:16 pm Rahoove Said:

    Hi, Your work seems the right thing for me. But I can’t see the codes in your write up.
    Rahoove

  2. On April 22, 2007 at 8:43 am benlevy Said:

    Sorry, I never ended up posting the rest. I should be doing that this week, though, as I have to revisit this myself for another project.

  3. On May 6, 2007 at 9:23 am lixin Said:

    WOULD YOU PLEASE RECOMMEND A BOOK ABOUT TO BUILD A .msi FOR ASP.NET APPLICATION? THANK YOU!!!

    L.X.

  4. On November 1, 2007 at 11:51 am ana Said:

    Actually it would very nice if you would recommend a book or a tutorial about .msi. thanx

  5. On November 7, 2007 at 1:27 pm Panya Said:

    Why start, if you won’t ever finish.

Leave a Comment