Hi David,
Thanks for getting in touch. This is quite timely, we also recently published a blog post about building .NET Core apps in .NET Core, in case you haven’t seen it yet.
In there we covered off a bit about why OctoPack isn’t practical in the .NET Core world. The bulk of the post focuses on using .NET Core build agents (e.g. Linux agents), but the pattern for building is the same whatever the agent platform is. We have been planning a follow up post with a more detailed walk-through, and based on your request I’ve bump its priority up.
Here’s a preview though The crux of the walk-through will be illustrating the TeamCity steps that correspond to the 3 commands shown in that post
dotnet publish MyAwesomeWebApp -o myMarshallingFolder
dotnet octo pack --id=MyAwesomeWebApp --version=1.0.0.0 --outFolder=myArtifactsFolder --basePath=myMarshallingFolder
dotnet octo push --package=myArtifactsFolder\MyAwesomeWebApp.1.0.0.0.nupkg --server=https://my.octopus.url --apiKey API-XXXXXXXXXXXXXXXX
The flow here is to publish the app to a folder, package the content of that folder then push the package to Octopus.
TeamCity has a step built in to handle the publish, if you go through the wizard and let it guess based on the repo contents it’ll probably include this straight up, it certainly did when I tested it. All you really need to do is decide on a folder name to publish to.
In the most recent update to our TeamCity extension we included a new Octopus step to do the pack (the update will work against any version of Octopus the previous version did, including 3.14, it’s now just exposing a function of octo.exe
that it didn’t previously). Previously you just had to use the file globbing support in the Push step to package and push in 1 step. In the pack step, give it the folder you published to as the Source directory and give it another folder to Output to. I tend to use something like “artifacts” or “packaged”.
From there, you have 2 options. If you’re using TeamCity as an external feed then check the box to Publish packages as build artifacts. If you’re using the Octopus feed, add a push step (which is the third command from above).
I set Package paths to artifacts/%PackageId%.%build.number%.nupkg
, where PackageId is a variable in TeamCity the pack and push steps both use. You can cheat here and use a wilcard instead of the exact filename, but I’ve had issues if the build folder doesn’t get cleaned out and it’ll try to publish the older versions it can see in the folder too.
Hope that helps and keep an eye out for the upcoming post, there’ll be illustrations that might make some it this clearer. If you have any other questions in the meantime please let me know.
Regards
Shannon