visual-studio 配置转换和“TransformXml 任务失败”错误消息
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2513123/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Config transformations and “TransformXml task failed” error message
提问by Troy Hunt
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:
在观看 Scott Hanselman 的web 部署视频后,我刚刚在 VS2010 RC 中的 .NET 3.5 项目上启用了配置转换。不幸的是,每次我去发布时,我现在都会收到以下错误:
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.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)
“TransformXml”任务意外失败。System.UriFormatException:无效的 URI:URI 为空。在 System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
在 System.Uri..ctor(String uriString) 在 Microsoft.Web.Publishing.Tasks.TransformXml.Execute() 在 Microsoft.Build.BackEnd.TaskExecutionHost。 Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() 在 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?
如果我使用一个全新的 VS2010 Web 应用程序,默认情况下它已经具有配置转换,我没有问题,所以我怀疑我的问题与项目有关。有没有人遇到过这个问题或对修复有任何想法?
回答by Troy Hunt
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.
看起来答案简单而晦涩;我有一个应用程序设置(密码),其中包含一个“>”符号。我尝试将应用程序转换为 .NET 4,然后再转换回 .NET 3.5,一切运行正常,因为在此过程中符号已转义为“>”。在配置转换出现之前,这个角色从来没有问题,但至少现在修复很简单。
Edit: blogged about in a bit more detail: Visual Studio 2010 Config Transformations TransformXml task failure
编辑:在博客中更详细地介绍了:Visual Studio 2010 配置转换 TransformXml 任务失败
回答by John Ruiz
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.
仅供参考:我的项目已经针对 .NET 4.0,所以我将其切换到 3.5,然后再切换回 4.0,它也可以这样工作。

