2

I've seen several other posts similar to this (namely https://stackoverflow.com/questions/5237/solutions-for-working-with-multiple-branches-in-asp-net) but there are several issues that I have that seem to be different than other similar posts.

I have an ASP .NET application that uses a virtual directory off of localhost. There are several spots in the code where I need to reference the name of the virtual directory so the virtual directory needs to be in place and named correctly in order for it to work. I'm also using my httpd.conf file to format my URLs to avoid cluttered querystrings.

That being said, I just published my application and now need to create a branched environment for bug-fixes whenever there is a bug in the live code and I don't want to upload the dev code.

The trouble is that I need to be able to easily run my branched code parallel to my dev code without needing to do a bunch of work with IIS and config files every time I want to load in my branched code. The drawbacks are that the parallel environment needs to have the virtual directory in place and work with the same httpd.conf (for URL formatting).

I don't think Cassini would work because I need SSL and of course...the httpd.conf and the virtual directories would need to still be in place.

The perfect solution in my mind would be to run a parallel website to localhost with the same httpd.conf and the same virtual directory...but I'm running XP Pro and they don't "do" multiple websites.

Community
  • 1
  • 1
Adam
  • 3,063
  • 5
  • 35
  • 49
  • @Joseph: Great idea! Does that command go in the web.config? Are you aware of a way to make sure that it only executes when in debug mode? – Adam Nov 20 '09 at 19:05
  • @danswain: You mentioned executing this command in a post-build event. Do you know of a good resource for build event commands? – Adam Nov 20 '09 at 19:05
  • Both answers were very helpful. I think I'm going to try and figure out how to change the iis virtual directory target path through a post-build event since I can check whether or not it's in debug mode when I'm in the post-build event. – Adam Nov 21 '09 at 00:19
  • So it took me awhile to figure out how to do this from the post-build event but I got it working. Basically I created a VBScript file that changed the metabase like this thread mentions: http://stackoverflow.com/questions/371207/can-i-automate-creating-a-net-web-application-virtual-directory-in-iis-5 . I needed to make a few changes so that instead of creating a new virtual directory it just accessed the existing one and changed the Path property. Then I called that script from my post-build event (using cscript) passing the name of the virtual directory and the new path as parameters. – Adam Nov 23 '09 at 18:21

2 Answers2

1

Have your build process create the virtual directory each time the build is run.

I've used NantContrib's mkiisdir task for this.

With this approach you can't run multiple branches simultaneously, but you can quickly switch between branches by building the branch you want to run.

Joseph Anderson
  • 2,838
  • 2
  • 26
  • 26
1

I would do as above, but you could hook it into your solutions post build event, but this wouldn't be parallel more a quick switch. I think there's a registry hack out there to get multiple sites in iis or if memory serves if you create an additional site through a script it works, it's just the GUI that's locked down. Or the better solution would be upgrade to windows server, and have different branches build to different ports.

danswain
  • 4,171
  • 5
  • 37
  • 43