Octopack - Duplicate .xml doc file in nuspec for web application

I’m running into an issue when octopacking a web application that needs to produce a XML documentation file (used to feed swagger). But only when running the build on the (TFS) build server.

The .XML file is created in the /src/…/bin folder of the application. Team Build copies the /src/…/bin files into another /bin folder. Octopack seems to pick up both copies of the .XML file however. Because both are in the nuspec, the “pack” won’t run.

I have tries different folder to output the XML file into, but none have worked so far.

Is there any way to solve this from my end? Or should octopack be more careful when building the list of files for the nuspec and maybe skip the bin folder when adding the content ?

<file src="E:\Builds\5762\Biblo\Trendstop_Main_Full\src\Source\src\Trendstop.WebApi\bin\Trendstop.WebApi.XML" target="bin\Trendstop.WebApi.XML" />
<file src="E:\Builds\5762\Biblo\Trendstop_Main_Full\bin\Trendstop.WebApi.dll" target="bin\Trendstop.WebApi.dll" />
<file src="E:\Builds\5762\Biblo\Trendstop_Main_Full\bin\Trendstop.WebApi.pdb" target="bin\Trendstop.WebApi.pdb" />
<file src="E:\Builds\5762\Biblo\Trendstop_Main_Full\bin\Trendstop.WebApi.XML" target="bin\Trendstop.WebApi.XML" />

I tried using the OctoPackNuGetArguments with an exclude, but the nuspec is already built at the moment, so it doesn’t help.

Would creating a custom nuspec with an exclude of one of the duplicate paths help? I don’t want to keep updating the nuspec when I add new files to the project, so OctoPackEnforceAddingFiles should be set to true. But I don’t think octopack will actually look at the exclude that is aleady in the nuspec file before adding all files.

Hi David,

Thanks for getting in touch. The idea behind OctoPack was to make the most common situations as simple as possible. We often find that once customers go beyond the simple cases, they want conflicting behaviour from OctoPack. What makes life easy for one customer will be hellish for another.

So our recommendation is to build your own .nuspec file with OctoPackEnforceAddingFiles=true. With some clever wildcard rules in your .nuspec you may find that life is good.

Beyond that, our recommendation is to have your build server produce the folder structure you want, and simply have it package that folder for you (this is built-in TeamCity and will be coming soon with VSO). Otherwise just handcraft your .nuspec file and call nuget pack on it.

At the end of the day, Octopus just needs a valid NuGet package, and OctoPack just includes some extra files (like Content, and bin) that nuget would otherwise ignore.

Hope that helps!
Mike

Hours and hours later, I figured it out.
The solution is very simple. A lot simpler than what was suggested. Especially because I don’t even have to create a nuspec.

Nuget has a command line option to “exclude” something. So I pass that in via octopack:

"/p:OctoPackNuGetArguments=-Exclude bin\Trendstop.WebApi.XML"

1 Like