Question

I am deploying my packages using teamcity and octopus. I am creating packages using teamcity and then using Octopus to deploy to different environments. I have a Resources folder which needs to be copied as a separate step in teamcity. Now I want that folder to be included in the package so I can then deploy that package to remote servers on other domains. I have defined the following file to include resources folder into the content folder of main project. but what's happening is It just create a folder in the destination but don't copy other files with in the project. Please guide as All I want is to include the resources folder with in the package along with my publish website files. I just want the resources folder to be part of package. Please guide

 <?xml version="1.0" ?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
 <metadata>
<id>Services</id>
<version>1.0.0.0</version>
<authors></authors>
<owners></owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Services.nuspec build package</description>
<releaseNotes />
 </metadata>
 <files>
  <file src="..\Resources\**\*.*" target="Content\Resources" />
</files>
</package>

Package contents after creating a package using the above code:-

 . _rels
 . package
 . content\resources 
 . [content_type
 . Services.nuspec
Was it helpful?

Solution

If you're using OctoPack, this behaviour is expected. To quote the documentation on GitHub:

If the <files> section exists, OctoPack won't attempt to automatically add any extra files to your package, so you'll need to be explicit about which files you want to include.

If you go this route, you'll need to specify all the other files you want included within the <files> section of the nuspec.

If you're not using OctoPack, a similar rule applies. See documentation on nuget.org

If you follow the conventions described in Creating a Package, you do not have to explicitly specify a list of files in the .nuspec file. Note that if you specify any files, the conventions are ignored and only the files listed in the .nuspec file are included in the package.

Update

One hybrid method I've seen used is to use the MSBuild Publish target to build & publish the website to a local folder, (to filter out all the compile time files like .cs source), drop in the additional files, and then simply include a <file src="**/*.*" /> to pack everything under the root publish folder. Requires a bit of customisation with root paths / nuget.exe, but it may make the process it a bit neater and slightly less maintenance.

Useful information here that may help you get started.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top