dovholuk
dovholuk

Reputation: 969

Setting the ASP.NET version via MSBUILD

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

Upvotes: 1

Views: 1072

Answers (5)

ocenteno
ocenteno

Reputation: 21

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)"

Upvotes: 2

Eduardo Xavier
Eduardo Xavier

Reputation: 1540

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,

Upvotes: 0

dovholuk
dovholuk

Reputation: 969

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

Upvotes: 1

Robert Wagner
Robert Wagner

Reputation: 17793

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

Upvotes: 1

Min
Min

Reputation: 2975

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

Upvotes: 1

Related Questions