Can OctoPack create and push a package when building from within Visual Studio?

Is there a way to have OctoPack create and push a package to the Octopus Deploy server when building from within Visual Studio?


Hi Ryan,

Thanks for getting in touch! Down the bottom of this doco page show a couple of extra properties you can set to push the package to our repository: (Under Publishing!)

Hope that helps!

Hi Vanessa,

Thanks for the quick reply. I think you may have misunderstood my
inquiry. I understand that I can create and push a package to Octopus
Deploy by running msbuild from the command line. The documentation does
outline this process very well.

What I am looking for is the ability to have OctoPack create and publish a
nuget package when I select a project from the Solution Explorer in Visual
Studio and select the “Build” action from within the IDE. I am not sure
how to do this or if it can be set up to do from within the IDE. Is this


Hi Ryan,

Yes, this can certainly be done.

Add the following <PropertyGroup> declaration in the .csproj file of the projects you want to create a NuGet package when built.


If you want to publish to a local folder or file share, you’d include the OctoPackPublishPackageToFileShare property tag, if you wanted to publish to a NuGet server, you’d include the OctoPackPublishPackageToHttp and OctoPackPublishApiKey property tags.

Hope that helps!
Henrik Andersson

Thanks Henrik! The instructions you gave worked perfectly. Now I can build each individual project in my solution from within Visual Studio and the nuget package gets created and pushed up to the feed on my Octopus Deploy server.

Thanks Again!

I have a database project, I just want to publish it to the server, without building it. Can I do that ?. The main reason is, I want to manually check for errors against the database.

Hi Jalan,

To be able to deploy using Octopus, you’ll need to pack your project into a Nuget package and then deploy it. Using Octopack, the only way to pack and push to a repository is by building your project.

Could you explain a bit more how are you planning to run your database project, and what do you mean exactly by “Manually check for errors”?



I have a stored procedure which adds columns to the table, and immediately I update the columns added in the same sp. I have already defined a table without these columns. Now, if I try to build, I encounter error because of the update statement in the sp as these columns doesn’t exist in the project when we build. These files are being published to the database, when I execute the stored procedure manually in the database, it will not lead to errors. The reason I want to publish without building is, I have many databases, some many need these columns and some may not. If I publish without building them, I can manually run the sp where the criteria is need, else leave as it is. Its like deploying without building.

Hi Jalan

You probably want to look at some sort of automated database migration, otherwise you’re going to consistently run into problems and not have a lot of fun.

Maybe have a look at the DBUp project
It will let you run migration scripts in environments and keep track of what has been run where. You can bundle that up into an executable which you can deploy with Octopus.

It will also let you deploy stored procedure scripts by electing to not journal what script has been run, so with a migration script you only want to run it once in a given database, with a stored proc you can tell DBUp to not log it so it will run every time.

Does that all make sense ?



I tried the suggestion in Henrik’s Nov 12, 2014 @ 07:57 AM post, using the publish to HTTP option with API key. No packages are getting pushed. Any ideas?

Sorry, I had the project unloaded. Reloaded the project and it worked fine.

But I have another issue. After pushing the first package, subsequent ones would not push.

(400) Bad Request…
The command … OctoPack.3.0.43\tools\NuGet.exe" push … exited with code 1.

Any ideas on this?

Hi there

It sounds like you’re trying to push the same version of the package more than once. Octopus will throw an error if you do that because we already have that package.

Does that make sense ?


Yes, that makes sense, however may I suggest that a more specific error message from OD would be helpful?


Yes it’s a bit awkward I agree. We actually return a message of “A package with the same ID and version already exists” with the HTTP 400, but the combination of the build process and NuGet.exe loses that so you don’t see it in the build logs.