I have a web application project in VS2010 and am using the "Build Deployment Package" facility to create an MSDeploy package file, very handy. I've found how to parameterise the application name, and parameterise web.config replacements, but the last requirement
I have has me running in circles...
I want to specify the name of the application pool to use, and if it doesn't exist, create it.
I see that if I configure my VS2010 project to use IIS, I can set it to "Include IIS settings as configured in IIS/IIS Express" and "Include application pool settings used by this Web project". So I see it's possible to include these settings in a deployment
package, but I do not want to rely on IIS environmental configuration to get the right deployment package because:
I shouldn't have to install IIS on my build server.
It would be a nuisance to configure IIS for each application I'm building.
Project-specific configuration should be stored in the project, not the environment! What if I want to re-build an old version? the environment configuration would need to be changed for each version I build.
How can I accomplish this? I've seen some discussion about using a <project_name>.wpp.targets file to jump into the web publishing pipeline to adjust the deployment package output files, this may be the way to specify what I want, but I'm darned if I know how.
I've just been doing the same thing...although I've only gone as far as overriding the name e.g. I haven't gone as far as specifying the ASP.NET version or the pipeline mode...I probably should and I'll get round to it once I've solved my other issue
http://forums.iis.net/t/1179953.aspx
I've overidden the pool name by providing a <project>.wpp.targets file to override the settings in Microsoft.Web.Publishing.targets, it takes a bit of working out (documentation is non existant) and I may have been a bit clumsy but basically I've provided
my own "_Destination_IisServer_IisAppPoolName" property.
Now when someone imports my package they get an option to override the application pool name and the default value is set to what is in my <project>.wpp.targets file rather than the value on my dev box.
You also might want to check you have the latest version of Microsoft.Web.Publishing.targets otherwise you won't get some of the options (including the app pool name) in the GUI when importing the package etc.
If you work out how to specify the other settings please post back here.
crossmonk - Could you provide an extract from your wpp.targets showing how you've set that property? I'm still a bit of an MSBuild noob (combined with being an MSDeploy noob is making progress rather slow).
I can certainly see how to set a property, but I'm left wondering what target I need to latch onto, and also whether I need some other properties? It looks like somewhere around the GetProjectWebProperties target would be the spot, but in my case
I think the conditions for that particular target fail because I'm not using IIS from my VS project.
I'm wondering further if it's possible for me to hard-code values in my manifest.xml. I can sync app pool settings from IIS into a package, and see what sort of values I need in archive.xml, but it's rather difficult to customise the contents of archive.xml
using VS2010 "publish". It's relatively easy to get content into manifest.xml though.
<_Destination_IisServer_IisAppPoolName>Your App Pool Name</_Destination_IisServer_IisAppPoolName>
</PropertyGroup>
The value is used to populate the "IIS Web Application Pool Name" parameter that you'll find in the auto-generated <package name>.SetParameters.xml in your package directory.
I really wish MS would provide a proper UI for setting this stuff, values like the app pool name are often going to be different on the build/package machine to the deployment target machine.
Reverse-engineering by dissecting verbose XML files is tedious and mistakes are very likely!
There's all kinds of useful looking parameters kicking around e.g. DestinationIisVersion I wonder what that does and how to set it? UI please...
I think your example there may be dependant on other package settings. I'm trying to create my packages without setting VS2010 to use IIS, which makes the package contents... a little bit different. But thanks for the input.
I've subsequently managed to do this by examining dump / sync packages from IIS and modifying archive.xml contents, but my real challenge now is to automatically produce a package from VS2010 that is compatible with IIS6 AND IIS7
AND includes AppPool configurations. What a mess...
Yes, as with most of the settings you have to unpick the dependencies to determine which parameter(s) makes it into the final output, in my case for a package produced through VS2010 with "Include application pool settings..." ticked this was the appropriate
parameter to override.
Would you like to share how you solved the issue? e.g. which parameters were involved in your scenario?
I've chosen not to use "Include application pool settings" for a number of reasons.
Reliance on IIS for development environment (I should be able to get away with using Cassini, or in a pinch, IIS Express). IIS has
environmental settings, the sort that I can't readily control in my project settings / source control environment. In other words, I could build a project on Monday and get one result, make no changes to the project, but find somebody has made changes
to IIS, and get a completely different result from the build on Tuesday. Unacceptable!
The settings copied from IIS are version-specific. If I'm using an IIS7 or 7.5 instance (and let's face it, in all likelihood, I will be), then the settings copied into the package will
not work in IIS6. So if I want to deploy a package that's IIS6 compatible, I have to package it
using IIS6. Again, unacceptable!
I still haven't perfected what I'm doing here, but I've examined the MSDeploy package structure by creating an application in IIS7, along with an AppPool, and dumped details of it from the metakeys into packages, using commands like this:
I've dumped metakeys to allow IIS6 compatibility. From these I've examined archive.xml to determine how the AppPool is created, and how it is assigned to the application itself.
With this knowledge I've added a <project_name>.wpp.targets file to my project, to get into the MSBuild web publishing pipeline. I've set the packaging settings to NOT package to a zip, so I can get easy access to archive.xml. In my wpp.targets file I have
a target set to AfterTargets="PackageUsingManifest" (I've found that target by examining the Microsoft.WebDeployment.targets file in program files\msbuild\microsoft\webdeployment\v10.0). In this target I've set a task like this:
This task uses an XML transform to modify the contents of my archive.xml (you'll note the archive2.xml output, since archive.xml is marked in use, as I said, I'm yet to perfect this). My archive.transform.xml looks like this, these are details I extracted
from my "AppPoolDetails.zip":
This has allowed me to manually specify an AppPool to be created. A similar examination of the AppDetails.zip has helped me determine how the metakeys are laid out for an application, though I haven't yet configured the output from VS2010 to
work this way. I think that if you use the default createApp / iisApp tags in the archive.xml file, you can't readily assign the AppPool itself. I
may be able to get away with leaving those default tags as-is, but adding an appropriate AppPool assignment metakey entry (as found in AppDetails.zip).
All this!... just try try and create a single package from VS2010, that is IIS6 compatible, and allows me to create and assign an AppPool...
Snixtor
11 Posts
Specify an AppPool in my VS2010 deployment package
Jul 15, 2011 06:28 AM|LINK
I have a web application project in VS2010 and am using the "Build Deployment Package" facility to create an MSDeploy package file, very handy. I've found how to parameterise the application name, and parameterise web.config replacements, but the last requirement I have has me running in circles...
I want to specify the name of the application pool to use, and if it doesn't exist, create it.
I see that if I configure my VS2010 project to use IIS, I can set it to "Include IIS settings as configured in IIS/IIS Express" and "Include application pool settings used by this Web project". So I see it's possible to include these settings in a deployment package, but I do not want to rely on IIS environmental configuration to get the right deployment package because:
- I shouldn't have to install IIS on my build server.
- It would be a nuisance to configure IIS for each application I'm building.
- Project-specific configuration should be stored in the project, not the environment! What if I want to re-build an old version? the environment configuration would need to be changed for each version I build.
How can I accomplish this? I've seen some discussion about using a <project_name>.wpp.targets file to jump into the web publishing pipeline to adjust the deployment package output files, this may be the way to specify what I want, but I'm darned if I know how.appPool Web Deploy 2.0 Visual Studio 2010
crossmonk
11 Posts
Re: Specify an AppPool in my VS2010 deployment package
Jul 15, 2011 11:33 AM|LINK
I've just been doing the same thing...although I've only gone as far as overriding the name e.g. I haven't gone as far as specifying the ASP.NET version or the pipeline mode...I probably should and I'll get round to it once I've solved my other issue http://forums.iis.net/t/1179953.aspx
I've overidden the pool name by providing a <project>.wpp.targets file to override the settings in Microsoft.Web.Publishing.targets, it takes a bit of working out (documentation is non existant) and I may have been a bit clumsy but basically I've provided my own "_Destination_IisServer_IisAppPoolName" property.
Now when someone imports my package they get an option to override the application pool name and the default value is set to what is in my <project>.wpp.targets file rather than the value on my dev box.
You also might want to check you have the latest version of Microsoft.Web.Publishing.targets otherwise you won't get some of the options (including the app pool name) in the GUI when importing the package etc.
If you work out how to specify the other settings please post back here.
Hope that helps :-)
Snixtor
11 Posts
Re: Specify an AppPool in my VS2010 deployment package
Jul 15, 2011 10:29 PM|LINK
crossmonk - Could you provide an extract from your wpp.targets showing how you've set that property? I'm still a bit of an MSBuild noob (combined with being an MSDeploy noob is making progress rather slow).
I can certainly see how to set a property, but I'm left wondering what target I need to latch onto, and also whether I need some other properties? It looks like somewhere around the GetProjectWebProperties target would be the spot, but in my case I think the conditions for that particular target fail because I'm not using IIS from my VS project.
Snixtor
11 Posts
Re: Specify an AppPool in my VS2010 deployment package
Jul 18, 2011 02:38 AM|LINK
I'm wondering further if it's possible for me to hard-code values in my manifest.xml. I can sync app pool settings from IIS into a package, and see what sort of values I need in archive.xml, but it's rather difficult to customise the contents of archive.xml using VS2010 "publish". It's relatively easy to get content into manifest.xml though.
crossmonk
11 Posts
Re: Specify an AppPool in my VS2010 deployment package
Jul 18, 2011 08:12 AM|LINK
@Snixtor - it's disarmingly simple:
<PropertyGroup>
<_Destination_IisServer_IisAppPoolName>Your App Pool Name</_Destination_IisServer_IisAppPoolName>
</PropertyGroup>
The value is used to populate the "IIS Web Application Pool Name" parameter that you'll find in the auto-generated <package name>.SetParameters.xml in your package directory.
I really wish MS would provide a proper UI for setting this stuff, values like the app pool name are often going to be different on the build/package machine to the deployment target machine.
Reverse-engineering by dissecting verbose XML files is tedious and mistakes are very likely!
There's all kinds of useful looking parameters kicking around e.g. DestinationIisVersion I wonder what that does and how to set it? UI please...
Snixtor
11 Posts
Re: Specify an AppPool in my VS2010 deployment package
Jul 21, 2011 11:53 PM|LINK
I think your example there may be dependant on other package settings. I'm trying to create my packages without setting VS2010 to use IIS, which makes the package contents... a little bit different. But thanks for the input.
I've subsequently managed to do this by examining dump / sync packages from IIS and modifying archive.xml contents, but my real challenge now is to automatically produce a package from VS2010 that is compatible with IIS6 AND IIS7 AND includes AppPool configurations. What a mess...
crossmonk
11 Posts
Re: Specify an AppPool in my VS2010 deployment package
Jul 22, 2011 09:42 AM|LINK
Yes, as with most of the settings you have to unpick the dependencies to determine which parameter(s) makes it into the final output, in my case for a package produced through VS2010 with "Include application pool settings..." ticked this was the appropriate parameter to override.
Would you like to share how you solved the issue? e.g. which parameters were involved in your scenario?
Snixtor
11 Posts
Re: Specify an AppPool in my VS2010 deployment package
Jul 24, 2011 11:21 PM|LINK
I've chosen not to use "Include application pool settings" for a number of reasons.
I still haven't perfected what I'm doing here, but I've examined the MSDeploy package structure by creating an application in IIS7, along with an AppPool, and dumped details of it from the metakeys into packages, using commands like this:
msdeploy -verb:sync -source:metakey="lm/w3svc/1/root/MyApplication" -dest:package="AppDetails.zip"
msdeploy -verb:sync -source:metakey="lm/w3svc/AppPools/MyApplicationAppPool" -dest:package="AppPoolDetails.zip"
I've dumped metakeys to allow IIS6 compatibility. From these I've examined archive.xml to determine how the AppPool is created, and how it is assigned to the application itself.
With this knowledge I've added a <project_name>.wpp.targets file to my project, to get into the MSBuild web publishing pipeline. I've set the packaging settings to NOT package to a zip, so I can get easy access to archive.xml. In my wpp.targets file I have a target set to AfterTargets="PackageUsingManifest" (I've found that target by examining the Microsoft.WebDeployment.targets file in program files\msbuild\microsoft\webdeployment\v10.0). In this target I've set a task like this:
<TransformXml Source="$(PackageArchiveRootDir)\Archive\archive.xml"
Transform="$(WebPublishPipelineProjectDirectory)\archive.transform.xml"
Destination="$(PackageArchiveRootDir)\Archive\archive2.xml" />
This task uses an XML transform to modify the contents of my archive.xml (you'll note the archive2.xml output, since archive.xml is marked in use, as I said, I'm yet to perfect this). My archive.transform.xml looks like this, these are details I extracted from my "AppPoolDetails.zip":
<sitemanifest xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<metaKey xdt:Transform="Insert" path="/lm/w3svc/apppools/TestPool123" MSDeploy.path="2" setProperties="9027,1099,9026,1002,9028,9039,9041" MSDeploy.setProperties="1" MSDeploy.MSDeployLinkName="Child1" MSDeploy.MSDeployKeyAttributeName="path">
<metaProperty name="AppPoolState" propertyId="9027" attributes="Volatile" userType="1" dataType="DWord" value="4" MSDeploy.value="9" MSDeploy.MSDeployKeyAttributeName="name" />
<metaProperty name="Win32Error" propertyId="1099" attributes="Volatile" userType="1" dataType="DWord" value="0" MSDeploy.value="9" MSDeploy.MSDeployKeyAttributeName="name" />
<metaProperty name="AppPoolCommand" propertyId="9026" attributes="Volatile" userType="1" dataType="DWord" value="1" MSDeploy.value="9" MSDeploy.MSDeployKeyAttributeName="name" />
<metaProperty name="KeyType" propertyId="1002" attributes="None" userType="1" dataType="String" value="IIsApplicationPool" MSDeploy.value="8" MSDeploy.MSDeployKeyAttributeName="name" />
<metaProperty name="AppPoolAutoStart" propertyId="9028" attributes="Inherit" userType="1" dataType="DWord" value="1" MSDeploy.value="8" MSDeploy.MSDeployKeyAttributeName="name" />
<metaProperty name="ManagedRuntimeVersion" propertyId="9039" attributes="Inherit" userType="1" dataType="String" value="v4.0" MSDeploy.value="8" MSDeploy.MSDeployKeyAttributeName="name" />
<metaProperty name="ManagedPipelineMode" propertyId="9041" attributes="Inherit" userType="1" dataType="DWord" value="0" MSDeploy.value="8" MSDeploy.MSDeployKeyAttributeName="name" />
</metaKey>
</sitemanifest>
This has allowed me to manually specify an AppPool to be created. A similar examination of the AppDetails.zip has helped me determine how the metakeys are laid out for an application, though I haven't yet configured the output from VS2010 to work this way. I think that if you use the default createApp / iisApp tags in the archive.xml file, you can't readily assign the AppPool itself. I may be able to get away with leaving those default tags as-is, but adding an appropriate AppPool assignment metakey entry (as found in AppDetails.zip).
All this!... just try try and create a single package from VS2010, that is IIS6 compatible, and allows me to create and assign an AppPool...