matthew_360
matthew_360

Reputation: 6061

How to get Octopack to use custom .nuspec file?

The documentation seems to be really incomplete. All it says is that you can use your own .nuspec file, but it makes no mention of where you're supposed to put it, or how to get octopack to use it.

http://docs.octopusdeploy.com/display/OD/Using+OctoPack

I've tried naming the .nuspec file the same thing that my solution is named and having it in the same directory. That didn't work.

I've tried modifying the .nuspec file that Octopack generates, but those changes just get overwritten every time I run it.

Everything else I try is just a shot in the dark.

Has anyone gotten this to work?

Upvotes: 9

Views: 6640

Answers (4)

eskimwier
eskimwier

Reputation: 1107

Another way to use a custom or conditional .nuspec file with OctoPack is by adding a PropertyGroup to your .csproj file, like this:

<PropertyGroup>
  <RunOctoPack>true</RunOctoPack>
</PropertyGroup>
<PropertyGroup>
  <OctoPackNuSpecFileName Condition="'$(Configuration)' == 'Release'">MyApp.nuspec</OctoPackNuSpecFileName>
  <OctoPackNuSpecFileName Condition="'$(Configuration)' != 'Release'">MyApp.Debug.nuspec</OctoPackNuSpecFileName>
</PropertyGroup>

Put the files MyApp.nuspec and MyApp.Debug.nuspec in the same directory as your .csproj file and you are good to go.

Upvotes: 6

qbik
qbik

Reputation: 5928

If you want to use a custom nuspec file (something different than your.project.name.nuspec, there is a msbuild property OctoPackNuSpecFileName, through wich you can specify your nuspec file, like this:

msbuild yoursolution.sln /p:RunOctoPack=true p:OctoPackNuSpecFileName=Dev.nuspec

Upvotes: 10

osij2is
osij2is

Reputation: 1556

Note, you don't have to have NuSpec as the OctoPack will generate one on the fly (based off the project file) if it's not there - that's what you were experiencing.

Granted, if you want to customize the NuGet package, the NuSpec is required. Check out the OctoPack source here: https://github.com/OctopusDeploy/OctoPack and you can see for yourself how the OctoPack works with the NuSpec.

Upvotes: 2

matthew_360
matthew_360

Reputation: 6061

blerg.

I'm a dummy.

The .nuspec file needs to be in the same directory as the .csproj file. This actually makes sense because it allows you to have a different nuspec file for each project in your solution.

Hopefully this post helps someone else.

Upvotes: 4

Related Questions