Question

I am trying to get Octopack to include some additional dll's that are not part of my Visual Studio project.

Is there a way to get Octopack to use my csproj files (as normal) and then specify just the additional files I need, rather than using the section in the nuspec. (Because then I have to maintain a list of all project files in my nuspec)

I am currently copying some shared libraries to a folder "/providers" in a pre-build event. Is there a way to extend on this to copy them somewhere that Octopack will see and package them?

Was it helpful?

Solution

You don't need to maintain a list of all your project files in your nuspec file, you can do this:

<files>
    <file src="MyProject.Website\**\*.*" target="" />
</files>

This will grab everything in your project (all files and sub directories). If that's too much for you, you can take advantage of exclusion rules:

<files>
    <file src="MyProject.Website\**\*.*" target="" exclude="MyProject.Website\docs\admin.txt" />
</files>

Hope that helps.

OTHER TIPS

The downside of the answer of grabbing everything inside your project directory via the nuspec is that this could include files you don't want (see the answer's subsequent exclusion example).

A probably better way to do this is to ensure in your project that you have your files defined as "Copy to bin" or "Copy as content" and then build via msbuild w/Octopack using an additional command line argument of /p:OctoPackEnforceAddingFiles=true which tells OctoPack to combine the csproj and the nuspec, so you don't have to call out ALL the possible paths with a wildcard, you can only include files in your nuspec that aren't picked up from the regular build process. This is supported as of version 2.1.3 of OctoPack.

You could also use regular Nuget.exe and MSBuild by just specifying your csproj file, and if a nuspec exists with specific paths it should join them together.

See these reference links for better examples.

https://getadigital.com/no/blogg/setting-up-your-project-and-teamcity-octopack-for-front-end-builds/

https://octopus.com/docs/packaging-applications/nuget-packages/using-octopack/octopack-to-include-buildevent-files

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