如何从nuget包中排除子目录和内容

如何从nuget包中排除子目录和内容

问题描述:

因此,我有一个网站要打包为Octopus Deploy.

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

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

我正在尝试排除"Dontwantthisfolder"

I'm trying to exclude the "Dontwantthisfolder"

所以我的nuspec看起来像这样:

So my nuspec looks like this:

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

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

虽然它不起作用,但我仍然得到"Dontwantthis"文件夹.

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

有人知道我怎么能做到这一点吗?

Anyone know how I can achieve this?

您非常接近.试试这个:

You're quite close. Try this:

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

我能够通过以下文件系统结构来排除DontWantThis:

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
         ...