DocGreene
DocGreene

Reputation: 31

Web Package: How to force MSBuild to use MSDeploy.IisApp instead of sitemanifest?

How do I force MSBuild to create a Web Package that uses the iisApp Provider Application Path such as "Default Web Site/Catalog"?

My build process is creating a package that uses a directory path (C:\Agent\_work\28\s\Catalog).

I have tried to add the "/p:DeployAsIisApp=True" in my MSBuild command, but that doesn't seem to make a difference.

If I set the virtual directory to my Visual Studio 2017 solution folder, then Export a Package through IIS Manager, the package is created the way I'm expecting.

I compared the archive.xml files between MSBuild and the IIS Export. Here is some partial output:

MSBuild:

<sitemanifest MSDeploy.ObjectResolver.createApp= ...>
  <iisApp path="C:\Agent\_work\28\s\Catalog ...>
  ...
</sitemanifest>

IIS Export:

<MSDeploy.IisApp MSDeploy.ObjectResolver.createApp= ...>
  <iisApp path="Default Web Site/Catalog" ...>
  ...
</MSDeploy.IisApp />

So IIS is exporting MSDeploy.IisApp while MSBuild is creating a sitemanifest.

How do I get MSBuild to match the IIS Export? I'm using the VSTS build system and the parameters I'm passing to MSBuild are:

MSBuild /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:PackageLocation="$(build.artifactstagingdirectory)\Catalog" /p:IncludeSetAclProviderOnDestination=False

Upvotes: 1

Views: 725

Answers (1)

DocGreene
DocGreene

Reputation: 31

I solved the issue.

The specific issue I had been experiencing was a line in the logs that looked like this:

Verbose: Parameter entry 'IIS Web Application Name/1' could not be applied anywhere.

Parameters.xml was this (broken):

<parameters>
  <parameter name="IIS Web Application Name"
         description="Full site path where you want to install the Catalog Application (for example, Default Web Site/Catalog)."
         defaultValue="Default Web Site/Catalog"
         tags="IisApp">
  <parameterEntry kind="ProviderPath" scope="iisApp" match="@defaultValue" />
</parameter>

I set the match attribute to an empty string. Then everything started working as expected. Working:

<parameters>
  <parameter name="IIS Web Application Name"
         description="Full site path where you want to install the Catalog Application (for example, Default Web Site/Catalog)."
         defaultValue="Default Web Site/Catalog"
         tags="IisApp">
  <parameterEntry kind="ProviderPath" scope="iisApp" match="" />
</parameter> 

Upvotes: 2

Related Questions