Home

Help with a config file question

I'm asking a question on Github about Cake and how it can load App.config entries and I know it's a problem LinqPad is solving.
Any chance someone can suggest an answer on there? Pretty please? :-)
https://github.com/cake-build/cake/discussions/4113

Comments

  • I don't really understand what you're asking. LINQPad 5 (for .NET Framework) lets you specify an app.config file, which is equivalent to including an app.config file in a Visual Studio project.

  • Sorry for the confusion. I know that LinqPad allows you to specify an App.config file - I'm using that in one of my Linqpad queries. I was hoping to get the same functionality into the Cake project.
    I was wondering how you turn the text I've provided into an app.config file and link it into the LinqPad.exe - it's not as if you could create a LinqPad.exe.config file in the LinqPad folder in Program Files, so how do you achieve that?

  • If you're willing to run the code in another application domain, you can specify a path to the app.config in the AppDomainSetup:

    var setup = new AppDomainSetup
    {
        ApplicationBase = "<application base folder>",
        ConfigurationFile = "<path to app.config>"
    };
    
    var domain = AppDomain.CreateDomain ("<friendly name>", null, setup);
    ...
    
Sign In or Register to comment.