I want the web.config transformations to work locally, but apparently the transformations only happen during deployment.
Does anyone know a way to run the msbuild target "TransformWebConfig" without going through the "rebuild" process, and also point and list the directory where to spit the converted web.config?
EDIT : using Sayed's answer, I created a .bat file to complete the task for me:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Msbuild.exe "D:\Demo\Transformation.proj" /t:TransformWebConfig copy /Y "D:\Demo\Web.config" "D:\MyProject\Web.config" del ""D:\Demo\Web.config"
"Transformation.proj" is a copy of the Sayed code snippet in the answer below. Just indicate the source, purpose and destination for the conversion. The new file, in this case, the converted "web.config" will be located in the directory "D: \ Demo". I just copy it to overwrite my web.config project and finally delete the generated file in the demo folder.
In addition, I created a macro to run this batch file and performed the conversion for me:
Public Module DoTransform Sub RunTransformBatchFile() Try Process.Start("D:\Demo\RunTransform.bat") Catch ex As System.Exception MsgBox(ex.Message) End Try End Sub End Module
You can also add a button on the toolbar to launch this part and / or assign a key combination.
Diego C. Aug. 31 '10 at 22:36 2010-08-31 22:36
source share