How to exclude a subdirectory and contents from a nuget package

天涯浪子 提交于 2019-12-22 10:34:46

问题


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?


回答1:


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


来源:https://stackoverflow.com/questions/26142479/how-to-exclude-a-subdirectory-and-contents-from-a-nuget-package

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!