Web Application 部署碰到的Transform.xml错误的问题
1. 先来看看错误的消息和提示:
Error 16 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)
碰到这样的问题一般都是webconfig里面有些字符不正确或者没有转义出现的问题。
错误的原因后来在webconfig中发现:
<target name="sqlTracing" xsi:type="File" fileName="${basedir}/sqllog.txt" layout="${longdate}:===========================> ${newline} ${message}"/>
修改成:
<target name="sqlTracing" xsi:type="File" fileName="${basedir}/sqllog.txt" layout="${longdate}:===========================> ${newline} ${message}"/>
就可以了。
像"<", “>”, "(", ")" 等特殊字符在webconfig中需要转义。