Setting ASP.NET version in IIS during installation of virtual directory

Topics: IIS and Web Services
Mar 25, 2011 at 12:48 PM



When I try to deploy my virtual directory with btdf (using IIS6) I notice that the directory uses ASP.NET 1.1 which means I manually have to change this to 2.0 after the installation.

Is there any way to include this in the VD configuration?





Mar 29, 2011 at 5:06 AM

Hi Espen,

I think the aspnet_regiis.exe tool is best for this purpose.  There's a different copy for each .NET version.  You can launch it with an Exec task in your .btdfproj inside a Target element like this:

<Target Name="CustomDeployTarget">
  <Exec Command="&quot;$(FrameworkDir)\aspnet_regiis.exe&quot; -s &quot;w3svc/1/Root/vdirname&quot;" ContinueOnError="false" />

The idea of this command is to set the version on a specific vdir and any apps defined below it in the hierarchy.  If you're not on the Default Web Site, you may need to modify the W3SVC/1/Root path.

Or, you can simply change the .NET version to 2.0 on the root website where you're creating this vdir, which will then automatically propagate to newly created vdirs.


Apr 8, 2011 at 8:49 PM

That worked. Thank you.