octopus-deploy,nuspec,octopack , When does OctoPack create the nuspec file?

When does OctoPack create the nuspec file?


Tag: octopus-deploy,nuspec,octopack

The Using OctoPack mentions

A .nuspec file describes the contents of your NuGet package. OctoPack automatically creates one if you haven't provided one, by guessing some of the settings from your project.

I've run msbuild with the /p:RunOctoPack=true flag set, and expect to see the .nuspec file in the project directory, but it isn't in the project directory or the output directory under /bin.

At what point is the .nuspec generated? Is it generated and saved or is it on the fly, if an overwrite .nuspec isn't provided?


It's typically best to create the NuSpec file in the root of your project that the OctoPack is installed in. To create the NuSpec file from the command line simply use nuget.exe:

C:\temp\nuget.exe spec c:\path-to-project\solution\project\myproj.csproj

This will create a myproj.csproj.nuspec file in the folder. You can edit the template however you please. Make sure to add the NuSpec within Visual Studio so that when TFS (or whatever CI you use) does a build, the NuSpec is copied and when the OctoPack is fired the NuSpec is already there.

That said, the OctoPack will generate a NuSpec on the fly if it doesn't find it. You can view the source on GitHub (line 234 defines the method GetOrCreateNuSpecFile()):


Like I said before, it's best to create the NuSpec file within your solution/project. For projects that aren't Web Apps in Visual Studio, there's a little work to be done in optimizing your packages for different projects (services, database scripts, MSIs, SSRS, etc. etc.)


When does OctoPack create the nuspec file?

The Using OctoPack mentions A .nuspec file describes the contents of your NuGet package. OctoPack automatically creates one if you haven't provided one, by guessing some of the settings from your project. I've run msbuild with the /p:RunOctoPack=true flag set, and expect to see the .nuspec file in the project...

Octopack for .Net 2.0 and msbuild 2.0

I was setting up number of projects to build NuGet packages and push onto NuGet server, so it could be later used by Octopus Deploy. All was fine until I needed to apply the same process to legacy projects. The error was: error MSB4062: The "OctoPack.Tasks.CreateOctoPackPackage" task could not be...

How to delete files a dependency installed after your package is installed

I'm working on a nuget package that depends on the Unity and Unity.Mvc4 packages. My nuspec file has them listed as dependencies. Everything works, but when my package is installed the dependencies are installed first. The Unity dependencies deploy files to the root of the project that my package has...

Octopack packaging windows service as if it were a web site

I have a windows service which contains the necessary components to allow it to render razor templates. This service listens on a message queue and sends emails, using the razor templates to generate rich html. Everything is working fine, however, when it comes to deploying it with Octopus Deploy, it...

Deploy Nuget package to multiple sites usingOctopus Deploy

I have 10 different sites that are the exact same site files just deployed to 10 different IIS sites. The only difference between the 10 sites is a web.config variable SystemID. This ID is used to pull the clients connectionstring from a DB before the user logs in. Once the...

Automatically pull packages on provisioning

We're hosting on EC2. I've read this article here for provisioning tentacles. Is there a script which will then tell that provisioned server to grab the latest packages (from the latest release of the environment it's provisioned for)?

How to fail Octopus deploy if missing vc2013 Redistributable Packages are missing

Ho can I check if the C++ redistributable packages for visual studio 2013 is installed and fail if not. I need to check if the x64 and x86 version is installed. https://www.microsoft.com/en-us/download/details.aspx?id=40784...

Retrieve --packageversion passed from TeamCity as a command line argument

When I create release from TeamCity, I specify --packageversion %build.number% as an additional command line argument. Is there a way to read that variable in Octopus Deploy? Looking at documentation, I've found only one variable containing "packageversion": Octopus.Action.Package.NuGetPackageVersionand it doesn't seem like what I need as it is specific to...

Change file name during Octopus Deploy

I need to provide variable for different environments. For each environment I need to change names for certain files. What is best way to change names of certain files on Octopus Deploy? Is it possible with some existing Octopus functionality or I need to run PowerShell script for that purpose?...

Add Binding To IIS With PowerShell Without Overwriting Existing

We use OctopusDeploy to create the website and we use the create website template that is on the community step sites. I have modified it slightly to ensure that if the website exists it adds the default binding however it is removing all the existing bindings. Is there a way...

Deploy a specific version of a NuGet package with Octopus

We have an automated build on TFS that creates a release in Octopus, which is autonomously deployed to a test environment. As part of this build we provide a --defaultpackageversion value that lines up with our release roadmap, e.g. - this version is assigned in the build template and...

how to create nuspec file in specific folder?

I tried to create .nuspec file in a different folder by giving path but it is giving me error Nuget.exe spec ..\MYDEMOFOLDER Nuget.exe pack ..\MYDEMOFOLDER\MYPROJECT.csproj pause want to create MYPROJECT.nuspec in ..\MYDEMOFOLDER folder location getting error to create nuspec file The package ID '..\MYDEMOFOLDER' contains invalid characters. Examples of valid...

Octopus nuget feed duplicated package names

I deploy several projects at one Octopus Deploy server. Some of the project names (i. e. Web) are the same between different Octopus projects. So when I publish these packages to a Octopus nuget feed, I guess they will overwrite each other (in case of the same version number). So...

Publish nuget package during TeamCity build to Octopus

There is a known problem that if you deploy during a TeamCity build, a previous version will be deployed (as the current will be available only after the build is finished). Documentation suggests creating a secondary TeamCity BuildConfiguration as a workaround but it sucks and seems not to work anymore...

Can I use my OctopusDeploy built-in Package Repository in Manage NuGet Packages?

I have a working Octopus Deploy server which has a library of packages I built. I have an assembly which depends on one of the assemblies which I have deployed in Octopus Deploy and which is currently in that repository. I tried adding it as a package source in NuGet...

TFS 2012 not copying transformed Web.Config to _PublishedWebsite

I have a web project with a config transform. On my local machine, when the project is built, the transform works fine. However, my project is pushed to TFS and built there, the config file is transformed in the main drop folder; However, the version in _PublishedWebsites is the original,...