3

In my ASP.NET MVC project I have added a parameters.xml file that looks like:

<?xml version="1.0" encoding="utf-8" ?>
<parameters>
  <parameter name="Application Pool" description="Application Pool Name" defaultValue="PreferredPool">
    <parameterEntry kind="DeploymentObjectAttribute"
                    scope="appHostConfig"
                    match="application/@applicationPool"/>
  </parameter>
</parameters>

Then I go ahead and build the deployment package:

MSBuild.exe myproject.csproj /t:Package /p:PackageLocation="C:\packages\myproject.zip"

And then I invoke the batch script generated (myproject.deploy.cmd) and deploy the app to a local IIS 7 server. The problem is, it is always the Default Application Pool that is assigned to the app instead of the PreferredPool as specified in parameters.xml.

What did I do wrong?

Ben
  • 282
  • 2
  • 10

1 Answers1

3

Change your parameterEntry's scope to "application":

<parameterEntry kind="DeploymentObjectAttribute" 
                scope="application" 
                 match="application/@applicationPool"/> 
Richard Szalay
  • 83,269
  • 19
  • 178
  • 237
  • I have seen this answer elsewhere, but doesn't seem to work for me... How does this get used by MSDeploy anyhow? – EdmundYeung99 Nov 27 '12 at 00:01
  • @EdmundYeung99 - It can only change the property if it's there to begin with. Open the package (sync to one if you're working with a non-package source) and have a look at the `archive.xml`. If you don't see an `` element with an `applicationPool` attribute, then the parameter won't do anything as there's nothing to change. – Richard Szalay Nov 27 '12 at 07:56
  • ok, that's my problem. How can I get an section generated in my archive.xml? I'm using msbuild to create my package – EdmundYeung99 Nov 27 '12 at 21:47
  • @EdmundYeung99 - Ask as a separate question (tag it as `msdeploy`), and I'll take a look. These comments aren't intended to be discussion forums :) – Richard Szalay Nov 27 '12 at 22:06
  • sorry you are right, I've created a new question: http://stackoverflow.com/questions/13594670/how-to-configure-application-pool-with-msdeploy. Thanks for your help – EdmundYeung99 Nov 27 '12 at 22:53