2

我在 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: 

我不确定它是否相关,但它肯定无济于事......从解决方案的资源管理器中执行“运行自定义工具”后(有时一次,有时两次......)所有这些错误都消失了,但它仍然远离愉快的开发体验。

有任何想法吗?

4

0 回答 0