I have a nlog configuration file which contains a connection string like this:
My problem is that this connectionstring differs depending on the environment I am deploying to.
Is there a way to do variable substitution on non-web.config files?
Using that format you will have to use a the Substitute variables in files feature. So change the config line like this: <variable name="NLogConnectionString" value="#{NLogConnectionString}"/> turn on the feature, and add ‘nlog.config’ to the list of files to substitute in.
Also add that variable to your project’s variables.
Okay, I now see what the problem is. We are running version 2.0 and apparently this version does not support the “Substitute variables in files” feature.