I have a windows service that I need to pack into a nuget package with OctoPack, but I have to exclude a directory called "Config" and a few other config files (these are instance specific and this will be deployed to multiple instances.) However the files are always included no matter what I put in the nuspec file.
Project directory:
Config <dir>
Code <dir>
app.config
settings.config
service.csproj
service.nuspec
Nuspec file:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<!-- Required elements-->
<id>service</id>
<version>0.0.0</version>
<description>service for app</description>
<authors>our team</authors>
</metadata>
<!-- Optional 'files' node -->
<files>
<file src="**" exclude="Config\" />
<file src="**" exclude="**\app.config" />
<file src="**" exclude="**\settings.config" />
</files>
</package>
Jenkins file:
bat "dotnet-octo pack --id=service --format=NuPkg --basePath=bin\\x64\\BuildServer --version=0.0.0.${env.BUILD_ID} --overwrite"
I'm sure there is an error in my nuspec file or something but I can't find any documentation for my specific case. Thanks.
Turns out I was way overthinking this. I just edited the Jenkins file to delete them before packing. Completely forgot that
batwas an option.However, the correct way to do it via nuspec would have been
srcmeans "include all directories and files inbin\x64\BuildServer, where all the dlls and such are after building. Andexcludemeans except these files. Note all paths are relative to where your nuspec file is (this is important!!!).