TFS – web sites based under IIS – how to handle branching

branchingiis7team-foundation-server

I'm just looking for some advice/best practice for this situation:

We have a solution with a couple of web sites in it (one is a web site project, the other is a web application project). We have both of these sites set up to use our installed IIS (v7), as we have other projects that we need to access these via localhost whilst debugging.

We've just moved to TFS (from GIT) – when we switch branches, I have to go and 'repoint' my virtual directories under IIS to point at the new branch, which is a bit of a nuisance. Does anybody have any advice/guidance as to what is the best way to approach this? I would note that I don't think that switching to using Cassini will suit our situation.

Best Answer

IIS Express might be an option. This article is about IIS Express with SSL but also can give you some idea's on how to configure for your problem.

Remember that IIS Express is really IIS. It's just "local personal not-a-service" IIS. That means that IISExpress puts its config files in C:\Users\YOU\Documents\IISExpress\config rather than in some machine-wide location.

My project is called "MvcApplication18" so I can open up my ApplicationHost.config and look for "MvcApplication18." You can too. There's my site, right there, in IISExpress's applicationHost.config:

<site name="MvcApplication18" id="39">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
        <virtualDirectory path="/" physicalPath="c:\users\scottha\documents\visual studio 2010\Projects\MvcApplication18\MvcApplication18" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:15408:localhost" />
    </bindings>
</site>

An other option might be to script the repointing of the virtual directories and call it where you think is appropriate (pre build step, separate script) MSBuild extensions could get you started in that direction.

Hope this helps.