我在Visual Studio 2012中定制了一个T4模板,在构建时我收到以下错误消息:
错误54运行转换:System.Runtime.InteropServices.COMException(0x80004005):找不到文件“E:\ xxx \ yyy \ zzz \ Sqlite \ SqliteUser.cs”。
Server stack trace:
at EnvDTE.ProjectItems.AddFromFile(String FileName)
at Microsoft.VisualStudio.TextTemplatingEC6A2B3A41C616DAF7A733C5085314E2C3F5CE23DBE80E719FD33995883D5E510F37A17C37D9079D1256CDE20C927D612B6A821F33CC97A0D9F806591BA9D314.GeneratedTextTransformation.EntityFrameworkTemplateFileManager.VsEntityFrameworkTemplateFileManager.ProjectSync(ProjectItem templateProjectItem, IEnumerable`1 keepFileNames)
at Microsoft.VisualStudio.TextTemplatingEC6A2B3A41C616DAF7A733C5085314E2C3F5CE23DBE80E719FD33995883D5E510F37A17C37D9079D1256CDE20C927D612B6A821F33CC97A0D9F806591BA9D314.GeneratedTextTransformation.EntityFrameworkTemplateFileManager.VsEntityFrameworkTemplateFileManager.<.ctor>b__6a(IEnumerable`1 keepFileNames)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase)
at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData)
at System.Action`1.EndInvoke(IAsyncResult result)
at Microsoft.VisualStudio.TextTemplatingEC6A2B3A41C616DAF7A733C5085314E2C3F5CE23DBE80E719FD33995883D5E510F37A17C37D9079D1256CDE20C927D612B6A821F33CC97A0D9F806591BA9D314.GeneratedTextTransformation.EntityFrameworkTemplateFileManager.VsEntityFrameworkTemplateFileManager.Process(Boolean split)
at Microsoft.VisualStudio.TextTemplatingEC6A2B3A41C616DAF7A733C5085314E2C3F5CE23DBE80E719FD33995883D5E510F37A17C37D9079D1256CDE20C927D612B6A821F33CC97A0D9F806591BA9D314.GeneratedTextTransformation.TransformText() E:\xxx\yyy\zzz\SqliteDataModel.tt
错误是针对文件的第1行第1行,因此它不会将我指向其中的特定位置。 错误中引用的文件 - “SqliteUser.cs” - 是模板创建的众多文件之一,其他文件没有错误。 此错误的结果是从T4模板生成的每个文件都出现“无法找到源文件xxx”错误。
当我尝试从解决方案资源管理器的上下文菜单调试T4模板时,我遇到以下异常:
System.Runtime.InteropServices.COMException was unhandled by user code
HResult=-2147417846
Message=The message filter indicated that the application is busy. (Exception from HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER))
Source=EnvDTE
ErrorCode=-2147417846
StackTrace:
at EnvDTE.ProjectItem.get_FileNames(Int16 index)
at Microsoft.VisualStudio.TextTemplatingEC6A2B3A41C616DAF7A733C5085314E2C3F5CE23DBE80E719FD33995883D5E510F37A17C37D9079D1256CDE20C927D612B6A821F33CC97A0D9F806591BA9D314.GeneratedTextTransformation.EntityFrameworkTemplateFileManager.VsEntityFrameworkTemplateFileManager.ProjectSync(ProjectItem templateProjectItem, IEnumerable`1 keepFileNames) in c:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes\EF.Utility.CS.ttinclude:line 2199
at Microsoft.VisualStudio.TextTemplatingEC6A2B3A41C616DAF7A733C5085314E2C3F5CE23DBE80E719FD33995883D5E510F37A17C37D9079D1256CDE20C927D612B6A821F33CC97A0D9F806591BA9D314.GeneratedTextTransformation.EntityFrameworkTemplateFileManager.VsEntityFrameworkTemplateFileManager.<.ctor>b__6a(IEnumerable`1 keepFileNames) in c:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes\EF.Utility.CS.ttinclude:line 2169
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)
InnerException:
我不确定它是否相关,但肯定没有帮助...... 从解决方案的资源管理器执行“运行自定义工具”(有时一次,有时两次......)后,所有这些错误都会消失,但它仍然远离愉快的开发体验。
有什么想法吗?