Project. Properties.Settings versus plain old appSettings?

Posted by BryanG on Stack Overflow See other posts from Stack Overflow or by BryanG
Published on 2010-03-11T21:08:47Z Indexed on 2010/03/11 21:09 UTC
Read the original article Hit count: 248

I have an assembly built that uses appSettings in the app.config...pretty straight forward. however, I'm referencing this assembly in a web service, and that web service contains the nAnt build file for this service plus being the entry point for everything. Ideally I'd like to be able to set the assembly's appConfig values from the build file, but is this possible? Or do I have to switch to using the Settings values of the assembly and do something like this in the build:

<xmlpoke file="${PublishLocation}\web.config" xpath="//applicationSettings/Namespace.AssemblyClass.Properties.Settings/setting[@name='ExchangeServer']/value" value="${ServerName}" />

You get the idea. Is this possible with just a config? My ideal situation would be to keep the settings more flexible in the appConfig so that when everything is on the server, if frogs rain down, I can update the assembly's config values without rebuilding the solution.

Is this even possible (the xpath is wrong, it's just an example of what I'd like to do):

<xmlpoke file="${PublishLocation}\web.config" xpath="//appSettings/Namespace/AssemblyClass/add[@key = 'ExchangeServer']/@value" value="${a}" />

© Stack Overflow or respective owner

Related posts about nant

Related posts about configuration-files