jaywayco
jaywayco

Reputation: 6286

How to exclude a subdirectory and contents from a nuget package

So I've a website that I'm trying to package for Octopus Deploy.

I've the following folder structure:

Web | Views | WantThis Dontwantthis WantThis1 WantThis2 ... (lots more) Scripts

I'm trying to exclude the "Dontwantthisfolder"

So my nuspec looks like this:

... <file src="..\Web\Views\**\*.*" exclude="**\Dontwantthis\**" target="web\Views" /> ...

It's not working though, I still get the "Dontwantthis" folder.

Anyone know how I can achieve this?

Upvotes: 4

Views: 4054

Answers (1)

Mike Bailey
Mike Bailey

Reputation: 12817

You're quite close. Try this:

<files>
    <file src="..\Web\Views\**\*.*" exclude="..\Web\Views\DontWantThis\*" target="Web\Views" />
</files>

I was able to get this to exclude DontWantThis with the following file system structure:

Root
   |
   Source
        |
        Test.nuspec
   Web
     |
     Scripts
           |
           Script.js
     Views
         |
         DontWantThis
                    |
                    Bad.cshml
         WantThis
                |
                Good.cshtml
         ...

Upvotes: 6

Related Questions