I'm not sure if I'm missing something obvious or if I just don't get the NuGet resource policy. Resources (.resource.dll) are excluded by default on package creation, according to https://learn.microsoft.com/en-us/nuget/create-packages/creating-a-package:
Resources are, in fact, a special case. When a package is installed into a project, NuGet automatically adds assembly references to the package's DLLs, excluding those that are named .resources.dll because they are assumed to be localized satellite assemblies (see Creating localized packages). For this reason, avoid using .resources.dll for files that otherwise contain essential package code.
However, the document referenced in the snippet above (https://learn.microsoft.com/en-us/nuget/create-packages/creating-localized-packages) states two ways of creating localized NuGet packages:
There are two ways to create localized versions of a library:
- Include all localized resources assemblies in a single package.
- Create separate localized satellite packages by following a strict set of conventions.
Both methods have their advantages and disadvantages, as described in the following sections.
While I get the advantages and disadvantages of the two approaches, I don't understand why there is no option to simply include resource files when creating a NuGet package from a .csproj project (i.e. use option 1.).
My goal is to be able to do:
- Create/update/complement a library project
foo.csproj
with localized resources and build it - Create a NuGet package out of it via
nuget.exe pack foo.csproj <Maybe some Parameters>
- Add/update the newly created NuGet package to another project
bar.csproj
and havefoo.csproj
's resources included automatically
To me that sounds like such a common requirement that it's hard for me to imagine that this isn't possible. What am I missing?