msbuild - Embed a conditional XML file in a dll -
i want create config class dll reads embedded resource. i've created multiple xml files configuration our different environments. have separate configuration each environment dev, qa, prod matches prefix on xml file.
.configuration/dev.config.xml .configuration/qa.config.xml .configuration/prod.config.xml
etc
we've never used msbuild before , confused because there seems 3-4 different ways of using (pre/post build events, xml scripting, custom tasks etc). i'm trying rename respective file config.xml , embed in dll, config class can read out when it's run.
i've seen similar questions embed file none embed , rename @ same time. assume sort of embedding need done pre-build event.
normally have tried few bits , bobs have no idea start this, if point me in right direction extremely grateful.
update:
so jlew should able this
<itemgroup> <embeddedresource include="configuration\$(configuration).config.xml" > <logicalname>config.xml</logicalname> </embeddedresource> </itemgroup>
what want (without having seen code) not rename input file, direct msbuild use "logical name" resource different file.
<itemgroup> <embeddedresource include="dev.config.xml"> <logicalname>myrenamedconfig.config.xml</logicalname> </embeddedresource> </itemgroup>
if using csc.exe
directly, can similar with:
csc ... /resource:dev.config.xml,myrenamedconfig.config.xml
Comments
Post a Comment