Specifying separate App.config for client library - jimper/googleads-dotnet-lib GitHub Wiki
By default, the Ads API .NET library gets its configuration from the application's App.config / Web.config. However, if you don't want to get your App.config cluttered, you could move the library-specific configuration into its own configuration file using the configSource property.
Modify your App.config to look like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="AdWordsApi"
type="System.Configuration.DictionarySectionHandler"/>
</configSections>
<AdWordsApi configSource="AdWordsApi.config"/>
…
</configuration>
The section name and the configSource depends on the API for which you are specifying configSource.
- For AdWords and AdxBuyer APIs, it should be
AdWordsApiandAdWordsApi.configrespectively. - For DFP API, it should be
DfpApiandDfpApi.configrespectively.
Now create another config file with the name you specified on configSource, and move the configuration node from your App.config into this file, as follows:
<?xml version="1.0" encoding="utf-8" ?>
<AdWordsApi>
… More settings
</AdWordsApi>The configuration node you move depends on the API for which you are specifying configSource.
- For AdWords and AdxBuyer APIs, the node to move is
AdWordsApi. - For DFP API, the node to move is
DfpApi.
Finally, include new configuration file in your project. Change the properties of this file to Always copy to output folder.
Now build and run your project. Your application will start picking up values from the new configuration file.