Home

configSections

edited September 2020

Is there a way to have LinqPad access a custom section in the config file? I've got my DLL included that has the class for the config section and I've updated the custom config like so:
<configuration> <configSections> <section name="MyCustomConfig" type="ThirdParty.MyCustom.MyCustomSection" /> </configSections> <MyCustomConfig apiKey="xxxxxxxxxxxxxxx" apiUrl="https://api.MyCustom.com/email/send/v1/"> <MyCustomEmails> <add name="CancelByUser" campaignId="xxxxxxxxxxxxxxxxxx" emailType="transactional" /> <add name="ReceiptGeneric" campaignId="xxxxxxxxxxxxxxxxxx" emailType="transactional" /> <add name="ReturnConfirmation" campaignId="xxxxxxxxxxxxxxxxxx" emailType="transactional" /> <add name="ShipmentConfirmation" campaignId="xxxxxxxxxxxxxxxxxx" emailType="transactional" /> <add name="SubscriptionReminder" campaignId="xxxxxxxxxxxxxxxxxx" emailType="transactional" /> <add name="GenericEmail" campaignId="xxxxxxxxxxxxxxxxxx" emailType="transactional" /> </MyCustomEmails> </MyCustomConfig> </configuration>
But when I try to run the app, on trying to load my configuration, I get an error that it can't load message.

An error occurred creating the configuration section handler for MyCustomConfig: Could not load type 'ThirdParty.MyCustom.MyCustomSection' from assembly 'System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. (C:\Users\Dev\AppData\Local\Temp\2\LINQPad5_gvdfpdqo\wcvsqt\LINQPadQuery.dll.custom.config line 4)
BareMessage = An error occurred creating the configuration section handler for MyCustomConfig: Could not load type 'ThirdParty.MyCustom.MyCustomSection' from assembly 'System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Filename = C:\Users\Dev\AppData\Local\Temp\2\LINQPad5_gvdfpdqo\wcvsqt\LINQPadQuery.dll.custom.config

I can't GAC this DLL, so I'm hoping there's a way to make it work.

Thank you.

Sign In or Register to comment.