Pipeline NuGet task won't publish resource DLL. Do I need a NUSPEC file?

I have a tiny .NET 5.0 C# project ("MyComponent") that builds in Azure DevOps YAML pipelines and publishes a NuGet package to an internal feed. It has English strings and French strings so it generates two outputs: MyComponent.dll and MyComponent.resources.dll

    |-- MyComponent.dll
        |-- MyComponent.resources.dll

My other projects do pull it from the internal feed and use it. Unfortunately when they pull it, the resources DLL does NOT get pulled to the client's build tree. Only MyComponent.dll is pulled. So I guess it's not getting published properly.

This is the entire publish task

- task: NuGetCommand@2
  displayName: 'Pack NuGet Package'
    command: 'pack'
    verbosityPack: Detailed
    packagesToPack: '**/MyComponent.csproj'
    configuration: 'x64\Release'
    versioningScheme: byBuildNumber
    includeSymbols: true

How do I make this thing also publish the resources dll in the "fr" subdirectory?

Is there some syntax option on this command task that I am missing? The docs list so many options, I'm lost. Do I need to write a .NUSPEC file?


1 answer

  • answered 2021-05-04 08:19 Leo Liu-MSFT

    Pipeline NuGet task won't publish resource DLL. Do I need a NUSPEC file?

    This is a matter of taste selection.

    You could edit the .csproj file to include the resource file(s) directly, like Shayki comment:

        <Content Include="resource\**\ClassLibrary2.resources.dll">

    The ** contains all localized folders.

    And we could also to create a NUSPEC file to explicitly add the resource file.

        <file src="bin\Debug\en\MyAssembly.resource.dll" target="lib\net40\en\MyAssembly.resource.dll" />
        <file src="bin\Debug\es\MyAssembly.resource.dll" target="lib\net40\es\MyAssembly.resource.dll" />