Home General

ConfigurationManager.AppSettings on LinqPad 8

I have a problem with the read of configurationmanager.appsettings, I want to debug with LINQPad 8 a program with a DLL library that I create. The problem is that the DLL library take a URL of a webserver from the config file (app.config if is a desktop software or web.config if it's a web app) but I don't know how to do this in linqpad 8.

In my DLL I use this instruction to take the URL of webserver (after I call the API from this URL):

string url = ConfigurationManager.AppSettings["Url"];

How can i create a fake app.config or web.config for using ConfigurationManager.AppSettings?
Thanks much.

Comments

  • I'm not sure that I fully the question. If you want to ensure that a .app.config or .web.config file is present in the output folder so that your code can read it, just press F4 and add a reference to that file. LINQPad copies anything that you reference (including config files) into the output folder.

  • I have to say, I had no idea the Query Properties panel could reference anything other than assemblies/libraries.

  • I tried to reference a config file. No connection string named 'JASContext' could be found in the application config file. Now this config file does work for this connection in VisualStudio projects. I also tried putting it in an app.config file in this folder. C:\Users\Ranny\AppData\Local\LINQPad\8.7.4

Sign In or Register to comment.