It is certainly true that web deploy creates an application package with the required files for any application to work. However it doesn’t keep a web.config file that can be tweaked depending on the environment the files are getting deployed. Also this use case doesn’t consider specific files per environment. That use case can be handled in some other way as despite what said Msdeploy is pretty customizable. 🙂
Alright, so create a web.config file that has a format as file name “Web.Release.config” down at the last and then keep web.config information for all the environments [where you would like to deploy your package] in this file.
Secondly create a parametrized xml file to remove unnecessary xml tags from the web.configuration file. Down below last file name “SetParameters_Release –Demo.xml”. So this xml file will basically remove all xml tags in web.release.config file except tags required for web.config file in “Demo Environment” during deployment to demo environment.
“C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\msdeploy.exe” -source:package=’\\some_shared_file_location\package.zip’ -dest:auto,ComputerName=”https://computername:8172/MsDeploy.axd?site=websitename“,UserName=xxxx’,Password=’xxxxx’,IncludeAcls=’False’,AuthType=’Basic’ -verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -setParamFile:”\\some_shared_location \SetParameters_Release -Demo.xml” -allowUntrusted -retryAttempts=2 –setParam:name=”IIS Web Application Name”,value=”WebSiteName ”
So out of box someone has to below process to deploy to any environment
New process with a tweak