Config transformations and “TransformXml task failed” error message
I’ve just enabled config transformations on a .NET 3.5 project in VS2010 RC after watching Scott Hanselman’s video on web deployment. Unfortunately every time I go to publish I now get the following error:
The "TransformXml" task failed unexpectedly. Syste开发者_StackOverflow社区m.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.Web.Publishing.Tasks.TransformXml.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult)
If I take a brand new VS2010 web application which already has the config transformations by default I don’t have a problem so I suspect my issue is project related. Has anyone come across this before or have any ideas on a fix?
Looks like the answer was simple yet obscure; I had an app setting (a password), which contained a ">" symbol. I tried converting the app to .NET 4 then back to .NET 3.5 and everything ran fine as during the process the symbol had been escaped to ">". Never had a problem with this character until config transformations came along but at least the fix is now simple.
Edit: blogged about in a bit more detail: Visual Studio 2010 Config Transformations TransformXml task failure
FYI: my project was already targeting .NET 4.0, so I switched it to 3.5 and then back to 4.0 and it works that way as well.
精彩评论