Connect VSTS Package Management to Octopus

As part of the Visual Studio Team Services offering, Microsoft have added a Package Management module. Though still only in preview mode, you are able to set up feeds and then publish NuGet packages either through NuGet command line or as a step in a Visual Studio build. I’m going to assume you’ve read the documentation and set up a feed, and that as part of your build you wish to publish a NuGet package to your new feed, and then you want to add the feed as a service on Octopus. I’m also going to assume you are using the NuGet package step instead of OctoPack to make your NuGet packages.

step1

The documentation for much of Octopus tells you to use OctoPack. Crucially, OctoPack cannot be installed into SSDT projects  because SSDT projects are not .net applications, so cannot make use of NuGet packages themselves without hacking at the sqlproj files. Whilst it’s not the worst thing in the world, I’d prefer to keep build and deploy as separate from each other as possible.

I’m also going to assume that you have a step to copy your NuGet package to a build artifact folder:

step2

Right, at this point you want to add a NuGet publisher step. Set the feed as an internal NuGet feed; this will then allow you to use the Package feed you have already set up. You just click “connect to feed” in  the Packages tab next to the feed you want to publish to, and copy the url (you can use the NuGet 3+ feed url here no issues.) No further configuration is required.

Now to set-up Octopus to connect to the feed. Return back to the feed and click again on “connect to feed”, only in the drop down choose NuGet V2, copy the url and “generate new credentials”. This will generate a password that is not stored anywhere, so you need to make a note of it somewhere. If you’re using a service account you may well need to log on to Visual Studio Team Service using the service account and generating a password for the account. It’s not great, but as far as I know it is the only way to do this right now (until Octopus supports NuGet 3+ and you can use the credential provider.)

Now switch over to your Octopus server, and go to Library –> External Feeds and click on “Add Feeds”. Name it something pertinent (Visual Studio NuGet Feed?), add the V2 url for the Visual Studio feed, and use your user name and the password that was generated for you. Save and test that you can see the NuGet packages stored in repository. If there are none then run a build or add a sample NuGet package. If you wish to go a step further and use the Octopus Relese Step, then you can follow the steps in the Octopus documentation, but ignore the use of OctoPack in MSBuild as the steps above will publish the NuGet package to the Visual Studio feed instead of the Octopus feed.

I’ve been using the packages feed for quite a bit, and it’s a welcome alternative to having to use NuGet or MyGet, but there’s till noting stopping from using them as external feeds.

Author: Richie Lee

Full time computer guy, part time runner. Full time Dad, part time blogger. Pokémon Nut. Writer of fractured sentences. Maker of the best damn macaroni cheese you've ever tasted.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s