azure-devopsnuget-packagebuild-pipeline

Copy config file from nuget package to application folder


Given:

a) .net core library that contains .json configuration file (not appsettings.json) that is built by azure pipeline and packaged into internal nuget package.

b) .net core application that uses package #a

Problem:

copy .json configuration file from #a into #b's output directory on each build without explicitly adding the file to #b project.

is this possible?


Solution

  • found the solution: "PackageCopyToOutput" flag. more info here https://learn.microsoft.com/en-us/nuget/reference/msbuild-targets#including-content-in-a-package