Archive for the 'msbuild' Tag

  1. Scripted Configuration of IIS7 on Vista with MSBuild

    I have an application that has an automated build script using msbuild which carries out all steps necessary to get the application configured and running on a local machine. Part of this process relates to configuration of IIS.

    I’ve just installed Vista, and initially ran into a few problems getting the build script to run sucessfully. IIS7 isn’t installed by default in Vista, so you need to go to Programs and Features manually and choose to install. When you do this, make sure you expand the IIS node in the treeview and check all of the features you require. By default the web server will install with a very limited range of features. The important one here is under II6 Management Compatability > IIS Metabase and II6 configuration compatibility.

    If you’re using the SBF task library for msbuild, the tasks for configuration of IIS use the WMI interface for configuring the webserver. This will continue to work so long as the previous configuration is checked when installing IIS7.

    The next problem you’ll face is to do with elevated permissions. When you carry out IIS configuration via the user interface, you’ll be prompted to elevate to admin permissions (the annoying dialog that pops up frequently). If you’re running a scripted build, this doesn’t occur so you’ll get an Access Denied exception when msbuild calls the IIS configuration tasks. Set up a shortcut for the command prompt (or use the VS.NET command prompt shortcut), right click on it, and choose “Run as Administrator”. This means that tasks which require administrative priveleges (but can’t ask for them via the UI) will complete successfully.

    IIS7 comes with a command line utility which allows you to do things like create websites or virtual directories. Long term it may be simpler if the msbuild tasks shell out to this utility rather than using WMI, but for the time being they would need to be able to configure IIS6 and 7, so WMI is the best approach.

    Posted at 2:18 pm on 9/12/06

    Tags: , , , ,

    Comments: None