Excluding all files of a type in NuGet
nuget, nuget-package, visual-studio-2012
Solution
I've just been having the exact same issue, but with .txt files. The solution as pointed out by a colleague is to change the Build Action from "Content" to "None".
Problem
Problem: I have .sql files in my Visual Studio project which I want to exclude from my NuGet package. These .sql files are nested into various directories, and I have been unable to successfully exclude all .sql files from my nuget package. 1: I've created a .nuspec file by running the following command on my target project: ``` nuget spec ``` 2: I've edited the resulting nuspec file so that it looks like this: ``` <?xml version="1.0"?> <package > <metadata> <id>$id$</id> <version>$version$</version> <title>$title$</title> <authors>$author$</authors> <owners>$author$</owners> <requireLicenseAcceptance>false</requireLicenseAcceptance> <description>Security Core Impl</description> <releaseNotes>Security Core Impl</releaseNotes> <copyright>Copyright 2013</copyright> <tags>Security Core</tags> </metadata> <files> <file src="**\*.dll" target="lib\net40\" exclude="**\*.sql;" /> </files> </package> ``` 3: I run the following command to build my .nupkg: ``` nuget pack -Prop Configuration=Release ``` Whenever I install this package into another project, however, the .sql files get included. I've tried a few different variations of the exclude above, and have tried the -Exclude switch. Nothing seems to work. All .sql files are marked: - Build Action: None - Copy to Output Directory: Do not copy I have also tried clearing my NuGet cache via Visual Studio options. Note: The NuGet package is hosted on a private server.