So I got a little bit inspired the other day after watching Scott Hanselman’s Web Deployment Made Awesome: If You're Using XCopy, You're Doing It Wrong from MIX10. With a perfect candidate ASP.NET 3.5 web app and VS2010 RC I dived in and generated Web.Release.config and Web.Debug.config files then went to publish. Unfortunately it didn’t all go to plan and all I got was this particularly uninformative error:
The "TransformXml" task failed unexpectedly.
System.UriFormatException: Invalid URI: The URI is empty.
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at System.Uri..ctor(String uriString)
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult)
After much toing and froing I discovered that converting the project to .NET 4 then back to .NET 3.5 solved the problem. Intrigued, I investigated further and found the root cause in an appSetting entry (values changed in this post for obvious reasons):
<add key="ServiceAccountUsername" value="domain\username" /> <add key="ServiceAccountPassword" value="doLW0>`dsP1>%!a" /> </appSettings>
A quick diff against the head source control copy showed the “>” symbol had been escaped to “>”. Reverting this change immediately caused the publish process to fail again. Password changed, problem solved.
I could find absolutely zero information on the web about this error message in the context of config transformations so hopefully this post will save someone else some pain one day.