TransformXml Task Failed Unexpectedly Error Message While Publishing Web Project in Visual Studio 2010

 

TransformXml task failed unexpectedly

one of the strange issues that I faced yesterday while trying to publish one of the web projects that I am working on. although the project compilation was working fine and when I run the project locally on my PC it was working fine without any issue.

After investigating for this issue I found the cause of this issue because the Web.config file was containing a special character inside it. so what I did is encode the special character then try to publish it again and things worked for me fine.

I had a very large Web.config file so looking for the special characters was not an easy job. I wrote a regular expression on Visual Studio that helped me on accomplished this job. so I would recommend to use regular expression to search Web.config instead of looking for the special characters inside the web.config file.