views:

502

answers:

5

I am trying to create a new website on a remote server via msbuild (I like to call it "msdeploy"). I've downloaded and used the SDC tasks, the MSBuildExtension tasks and the MSBuildCommunity tasks but I simply can't get it right.

I figure that WebDirectorySetting (from MSBuild.Community.Tasks.IIS) is my best bet but I can't find the right SettingName to pass.

I'd like to use some sort of MSBuild task to accomplish this but maybe it just doesn't exist. Custom VBS or WMI are my last resort...

Thanks

+1  A: 

I've tried to do the same thing for a while but ended up realizing that we basically use version 2.0 for everything so I made that the default with aspnet_regiis on the machines I deploy to.

If you can run a shell command on the remote server you can use aspnet_regiis.exe with the -sn to register a specific asp.net version to an application.

http://msdn.microsoft.com/en-us/library/k6h9cz8h(VS.80).aspx

Min
+1  A: 

Run the aspnet_regiis tool from within your msbuild task with an Exec tag. It's not as "clean", but it works.

Robert Wagner
+1  A: 

thanks for your replies. I toyed around with doing both of these suggestions but neither is "exactly" what I was looking for - even if it gets the job done. I can't see us ever going back to 1.1 either so we did end up making it the default but i'm still holding out hope that there's a magic setting on some task that can do this.

thanks again

dovholuk
A: 

None of this works simple as the following lines:

First, create the website directory:

<WebDirectoryCreate
    ServerName="$(DeployServerName)"        
    VirtualDirectoryName="MyVirualSiteName" />

Second, Apply the ASP.NET version you want:

<InstallAspNet 
    Path="W3SVC/1/Root/MyVirualSiteName" 
    Version="Version20" />

Have my best,

Eduardo Xavier
A: 

Hi,

on IIS7 you can do it this way with MSBuild Extension Pack:

<MSBuild.ExtensionPack.Web.Iis7AppPool TaskAction="Create"
              Name="$(AppPool)"
              IdentityType="SpecificUser"                  
              PipelineMode="Integrated"
              ManagedRuntimeVersion="v4.0"
              PoolIdentity="$(UserName)"
              IdentityPassword="$(UserPassword)"
ocenteno