Search code examples
nuget.net-standard-2.0

Net Standard Library - Add files to nuget content folder on 'dotnet pack'


Is there an automated way to include a config transform file in the nuget package that is created when using the dotnet pack command?


Solution

  • I was able to do this by adding the xdt transform files in the class library project and then editing the csproj file to have this ItemGroup.

     <ItemGroup>
        <Content Include="app.config.uninstall.xdt" />
        <Content Include="app.config.install.xdt" />
      </ItemGroup>
    

    When doing a dotnet pack this automatically adds them to the content folder of the nuget package.