-1

The nuget project targets .NET 4.0, and uses a .nuspec file for all the nuget configuration.

My project currently uses an App.config file.

I have successfully managed to package my project.dll, project.pdb, and project.dll.config (app.config) into my NuGet package.

When I try to build the project using my NuGet package I can see that the resulting bin folders don't contain my config file.

It should be noted that if I build in Rider, the installation works correctly and the config file is copied.

Ask me anything, so far all I have really tried is using in my .nuspec.

Mike.C
  • 3
  • 2
  • For whoever put a -1, please state why, as you can see I'm new to stackoverflow and would love some advice to improve my question. – Mike.C Sep 07 '18 at 18:41
  • My wild-guess on why the -1 would be your saying "so far all I have really tried". Stackoverflow works best when any other resources are exhausted, and the asker includes any keywords/phrases they've tried in google. But yes I feel its strongly against the community to down-vote a new user without a comment explaining why one would make that decision, down votes are taken quite seriously generally (you lose a couple reputation for each down vote you make) – Thymine Sep 07 '18 at 22:55

1 Answers1

0

If your nuget needs config values, you should either have them be optional by default and document how to configure your library, or you need to use config transformations

.Net only loads one config file, the one that matches the main exe it is running. So even if you manually copied your project.dll.config into the folder with the binary, I do not believe it would get loaded. (that one config file can load others, but its best to use the transformations to add your values to it, so that the end-user of your library can modify them as they need)

I'll admit I'm not very familiar with Rider, but Nuget is intended to be a dependency library manager, and libraries should not have their own "semi-secret" config files. I'd be very curious what it is doing if your config file values actually get loaded, or how you are accessing the values (to my mind you should be using the same build-in functions to load app.config values as if you're in the main exe).

Thymine
  • 8,775
  • 2
  • 35
  • 47