1
votes

I am trying to use TeamCity and Octopus Deploy for a CI/CD process of a solution built on .NET Core 2.0. I am having trouble with configuring the build steps in teamcity correctly, as I do not get any packages created. I am using the .NET Core Plugin for TeamCity with the corresponding steps:

  • 'dotnet restore'
  • 'dotnet build'
  • 'dotnet pack'
  • 'dotnet publish'

I also include a 'OctopusDeploy Package' step, but as there is no packages produced, so this step does nothing.

The poject does not contain any .json files for the project (only some config files), but .csproj files. I am new to this whole CI/CD process, but I have successfully implemented it for a .NET Framework 4.6.1 solution using octopack.

Any idea on how I can solve this? Any feedback is greatly appreciated.

2

2 Answers

4
votes

I have managed to get it working with packaging into *.zip package files with octo.exe tool.

So I have following TC build steps to build release in Octopus:

  1. Dotnet Restore - .NET Core (dotnet) - restores NuGet packages
  2. Gulp (optional) - Gulp - runs gulp tasks
  3. Dotnet Test (optional) - .NET Core (dotnet) - runs tests in test projects
  4. Dotnet Build - .NET Core (dotnet) - builds the project
  5. Dotnet Publish - .NET Core (dotnet) - publishes project to specified output directory
  6. * Octo Pack - Command Line - executes 'octo.exe' command line tool with the following command octo pack --id %PackId% --version %PackVersion% --basepath %PackDirectoryPath% --format zip --outfolder %ArtifactsDirectoryPath%
  7. Octo Push - OctopusDeploy: Push packages - pushes packaged files to Octopus built-in package repository
  8. Octo Create Release - OctopusDeploy: Create release - creates release in Octopus with desired packages included in it

* Obviously you should install octo.exe tool on TC agent server and add it to PATH variable to be able calling it from TC build.

3
votes

With DotNet Core now you dont have to do all these setps.

Nuget package can be generated as part of the build step.

Follow these simple steps

  1. Right click on the project (.csproj) and select properties
  2. On properties screen, select Package tab from the right hand side menu and tick (select) Generate NuGet package on build.
  3. Input basic package settings like package id, version, author and etc (should be auto filled)
  4. Save

    Run one build on TeamCity with simple dotnet build step before moving to next step.

  5. Go to Team City project build settings

  6. Select General Settings, On the Artifact Path select tree icon and navigate to Bin\Release folder you will see your Nuget Package there. Select that file and Save.

Run the build again in Team City and you will see NuGet package file in the artifacts after successful completion of the build.

Hope this helps as you can see no need for Octopus Pack or Dotnet Pack steps