Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3170

Create a Nuget package with just a resources file using dotnet pack

$
0
0

A couple years ago, I set up my build to create separate packages for a main library a number of language resource files.

Project structure:

- proj  - localization    - lib.nuspec    - lib.de.nuspec    - lib.es.nuspec    - ...

One of the language nuspec files

<?xml version="1.0" encoding="utf-8"?><package><metadata minClientVersion="2.12"><id>JsonSchema.Net.de</id><version>1.0.0</version><!-- ... --><language>de</language><dependencies><dependency id="JsonSchema.Net" version="6.0.0" /></dependencies></metadata><files><file src="..\bin\Release\netstandard2.0\de\lib.resources.dll" target="lib\netstandard2.0\de" /></files></package>

Creates multiple nuget packages

lib.nupkg - contains lib.dll and lib.resources.dlllib.de.nupkg - contains only de/lib.resources.dlllib.es.nupkg - contains only es/lib.resources.dll...

I use a GitHub Actions matrix build to fan out packing the languages using nuget pack, passing the nuspec file, and everything worked really well.

But recently, nuget.exe stopped working on ubuntu because apparently it requires mono, which isn't supported anymore and has been removed from the ubuntu image.

Now I have to figure out how to do this with dotnet pack, which requires a csproj file and doesn't support nuspec files.

I've tried creating a lib.de.csproj file that just includes the resx file. It builds and includes the de/lib.de.resources.dll, but it also includes a lib.de.dll file, and I'm guessing that de/lib.de.resources.dll won't be loadable by the lib.dll. I don't think this is going to work in the end.

I've also considered creating different build profiles to the lib project, but I can't figure out how to exclude the lib.dll from the language packs, or if doing this is even supported.

I may end up needing to raise an issue in the dotnet cli repo, but I thought I'd ask here first.


Viewing all articles
Browse latest Browse all 3170

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>