Transforming web.config before publishing to server with WebDeploy (TransformXml)
I have a WebAPI / EntityFramework project that I am working on and I publish updates to the server quite often (using WebDeploy).
My setup uses custom defaultConnectionFactory in order to create connection string based on certain criteria.
Every time I push an update to sever, an new connection string is added to my web.config file: name: MyProject.Lib.Data.DataContext value: MyProject.Lib.Data.DataContext_ConnectionString
right before </Project> closing tag. But could not go any more further.
The article states that I need to
place <TransformXml Source="web.config" Transform="web.release.config" Destination="$(DeployPath)\web.config" /> in the right item group
and then
make sure that target gets fired prior to the call to Package
That's where I got confused:
- Where should I place the <TransformXml ... /> section and how to I find out which is the "the right ItemGroup"
- How do I "make sure that target gets fired prior to the call to Package"