Search code examples
.net-coreazure-devopschocolateyself-contained

Azure DevOps: publish self-contained .net Core app with Chocolatey


I need to create a self-contained .net core (3.1 in my case) app and to pack & publish using chocolatey so it can be installed and used.

I'm using Azure DevOps and have a feed on my own where I'm supposed to publish the chocolatey package.

The objective is to do this in the build pipeline, so, among other tasks I have:

  • dotnet publish task: creates the self-contained executable
  • chocolatey pack task: creates the .nupkg from a very simplistic .nuspec (only mandatory fields) I created.

My current problem is that the .nupkg file created contains always the project files and not the executable generated.

To try and work around it I even made the chocolatey pack's task work directory the same as the dotnet publish's task output one.

enter image description here

enter image description here

What am I missing? Is there another approach?


Solution

  • After a few tests I realized that the chocolatey pack will "pack" all files that in exist in the same folder as the ".nuspec". Not sure this is because I don't set anything on tool.

    Basically, my solution was to copy my ".nuspec" file to the folder where my executable was.