tags:

views:

269

answers:

3

We would like to change a web site from version 1.1 to 2.0.50727 during the installation of a solution.

We would prefer a solution that could do this in code.

We can do this by running Aspnet_regiis -i . However, this has a drawback that it changes the version for all sites on the server, and the customer may have other sites that we should not change.

Is there a way to do this in code?

Is there a way to run Aspnet_regiis such that it only affects a single site on the web server?

+1  A: 

Is there a way to run Aspnet_regiis such that it only affects a single site on the web server?

Yes.

Run aspnet_regiis -? and it will list all its options, including how to specify a virtual directory (it will include all child virtual directories as well).

Richard
+1  A: 

For a virtual directory use:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis /s W3SVC/1/ROOT/<YourVirtualDirectoryName>

Where 1 (W3SVC/1/ROOT) is the website id.

grenade
A: 

Found a similar question on stackoverflow with an answer that used code:

http://stackoverflow.com/questions/1299084/iis-6-0-directoryentry-scriptmaps-property-and-set-net-version

Shiraz Bhaiji