Ray Saltrelli
Ray Saltrelli

Reputation: 4218

How do I get MSDeploy to pusblish additional files to Azure?

I have an ASP.NET Web API project that is bound to a TFS source control repository hosted on tfs.visualstudio.com and a continuous integration build (also on tfs.visualstudio.com) which publishes the output to Azure. The CI build triggers properly and the build output is deployed to Azure but I want the deployment to also include XML documentation files as they drive the help page of my Web API project.

After doing some Googling, I found a blog post indicating that I should add the following to my pubxml file:

<PropertyGroup>
    <CopyAllFilesToSingleFolderForMsdeployDependsOn>
        CustomCollectFiles;
        $(CopyAllFilesToSingleFolderForMsdeployDependsOn);
    </CopyAllFilesToSingleFolderForMsdeployDependsOn>
</PropertyGroup>
<Target Name="CustomCollectFiles">
    <ItemGroup>
        <_CustomFiles Include="bin\**\*.xml" />
        <FilesForPackagingFromProject Include="%(_CustomFiles.Identity)">
              <DestinationRelativePath>bin\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
        </FilesForPackagingFromProject>
     </ItemGroup>
</Target>

This works if I manually publish from Visual Studio 2012, but does not work when my CI build publishes its output. The CI build does not publish the XML documentation files.

Why would this behave differently on the Team Build server than on my development box?

Upvotes: 4

Views: 2482

Answers (2)

Iouri
Iouri

Reputation: 21

The only change needed for publishing XML documentation files is this:

<ExcludeXmlAssemblyFiles>False</ExcludeXmlAssemblyFiles>

Upvotes: 1

Jimmy
Jimmy

Reputation: 28376

According to http://blogs.msdn.com/b/aaronhallberg/archive/2007/06/07/preserving-output-directory-structures-in-orcas-team-build.aspx, your Team Build server uses $(OutDir) to determine where the files should go during your build. On your development box, it usually uses $(OutputPath) from the .proj file.

$(OutputPath) usually is the bin folder under your project folder; it looks like you've pointed at bin (without using the $(OutputPath) variable) for the Include value for your custom files. Experiment instead with using something like $(OutDir)\**\*.xml to get the actual output path at build time, regardless of environment.

Upvotes: 4

Related Questions