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

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:

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?

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.