Is it possible to use a connection string from a nuget package? I am working on an internal package and would like to use the connection string from the App.config instead of having each project include the connection string.
Asked
Active
Viewed 532 times
0
-
At least you can pull connection string as param. I definetly sure that you can read config file from your package. – Basil Kosovan Jun 26 '19 at 16:31
-
I can read the string from the web.config in the project. but not the config file in the package – TheDizzle Jun 26 '19 at 16:36
1 Answers
0
ConfigurationManager uses .config file from executable project. If you want read info from file which is not in your project you can’t use ConfigurationManager. You can transform projects .config file and this values will be accessible by ConfigurationManager, see links
https://learn.microsoft.com/en-us/nuget/create-packages/source-and-config-file-transformations https://haacked.com/archive/2010/11/19/nuget-transformation.aspx

Basil Kosovan
- 888
- 1
- 7
- 30