How to exclude a folder from a nuget package

To directly answer the posters question, if you want to exclude only the obj folder from a Nuget package use the following in your nuspec xml

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

I needed to create a WebApplication, but deploy it as a standard ASP.NET website using "CodeFile" attributes.

This was basically to update a page in the standard ADFS login site.

<files>
  <file src="**" exclude="**\*.dll;**\*.designer.cs;**\*.csproj;**\*.pdb;**\*.user;**\*.vspscc;bin\*.cs;bin\*.aspx;bin\*.config;bin\*.asax;bin\*.pubxml" />
</files>

Depending on the project you are building, you shouldn't need to exclude anything.

If you are building a Windows Service/Console application, OctoPack should only package your bin\release directory.

If you are building a web application, you should use a 'publish' command to have MSBuild sent the binaries and content files to a temporary folder, and OctoPack will package that. This way your obj folders and C# files won't be packaged.

For information on how to do this, please see the section on Web Application Publishing at:

http://octopusdeploy.com/documentation/packaging/octopack