.net project: Octopack keeps adding \obj output when I publish web app with msbuild

Michael's Avatar


11 Aug, 2017 08:19 PM

I have a asp.net web project with Angular 4.

I've created a publish profile (pubxml), where I have a task to compile Angular part: npm install and npm run build. To include all js files into the Octopus package, I've created .nuspec file that has has the following line:

<files><file src="dist\*.*" target="dist" /></files>

When I run msbuild with the publish profile argument:
MSBuild test.sln /t:Build /p:DeployOnBuild=true /p:Configuration=Development /p:PublishProfile="Development" /p:RunOctoPack=true /p:OctoPackEnforceAddingFiles=true

Octopack creates a nuget package that includes everything from "\obj" folder of the solution. In my case, it contains the compiled web application and a set of binaries. Thus, I've got 2 sets of binaries in the package. Check image for details.

According to description, Octopack takes only \bin output + all content marked project files (that can be changed from the project settings. In my case it's "bin"). How to make it not take obj output?

  1. Support Staff 1 Posted by Rob Erez on 14 Aug, 2017 12:04 AM

    Rob Erez's Avatar

    Hi Michael.
    When you use the OctopackEnforceAddingFiles=True parameter, Octopack will include all the usual files (typically found in \bin) in addition to the explicitly specified files in the .nuspec file.

    In your case it sounds like you want to have finer-grained control over the files that are included in your nuget file. To that end, I would suggest you remove the OctopackEnforceAddingFiles=True parameter, and explicitly add the bin directory in the .nuspec while at the same time explicitly excluding the contained obj directory that is being created as part of your build as per this stackOverflow post.
    Let me know if this solves your packaging problem.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Already uploaded files

  • octopack.PNG 89.4 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac