使用t4时出错 [英] Error when using t4

查看:147
本文介绍了使用t4时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
当我尝试用gat展开.tt(置于vs模板中)文件或当我使用TextTemplateAction执行t4文件时,我收到以下错误:

错误:0:Microsoft.Practices.RecipeFramework.ActionExecutionException:绑定期间发生异常配方CreateDataLayerLibrary的引用或执行。错误是:操作GenerateDataLayer无法执行:


无法找到路径'D:\Dev \ GSL \SoftwareFactory \Trunk \GAT \ RAD \\的一部分\\ Package\GSL.SoftwareFactory.GAT.Package\bin\Debug\Templates\SQL\StoredProceduresGenerator.tt'..


您可以删除对此食谱的引用通过指导包管理器。 ---> System.IO.DirectoryNotFoundException:找不到路径'D:\Dev \ GSL \SoftwareFactory \Trunk \GAT \RAD \Package \ GSL.SoftwareFactory.GAT.Package \ bin的一部分\Debug \Templates\SQL \ StoredProceduresGenerator.tt'。


在System.IO .__ Error.WinIOError(Int32 errorCode,String maybeFullPath)


at System.IO.FileStream.Init(String path,FileMode mode,FileAccess access,Int32 rights,Boolean useRights,FileShare share,Int32 bufferSize,FileOptions options,SECURITY_ATTRIBUTES secAttrs,String msgPath,Boolean bFromProxy)

$ System.IO上的System.IO.FileStream..ctor(字符串路径,FileMode模式,FileAccess访问,FileShare共享,Int32 bufferSize,FileOptions选项)


中的b $ b

。在System.IO.StreamReader..ctor(字符串路径,编码编码)中的StreamReader..ctor(String path,Encoding encoding,Boolean detectEncodingFromByteOrderMarks,Int32 bufferSize)


$ b System.IO.File.ReadAllTe上$ b

Microsoft的Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction.Execute()


中的xt(字符串路径,编码编码)


.Practices.RecipeFramework.Recipe.Microsoft.Practices.RecipeFramework.Services.IActionExecutionService.Execute(String actionName,Dictionary`2 inputValues)


at Microsoft.Practices.RecipeFramework.Recipe.Microsoft.Practices .RecipeFramework.Services.IActionExecutionService.Execute(String actionName)


at Microsoft.Practices.RecipeFramework.Recipe.Microsoft.Practices.RecipeFramework.Services.IActionCoordinationService.Run(Dictionary`2 declaredActions,XmlElement在Microsoft.Practices.RecipeFramework.Recipe.ExecuteActions(IDictionaryService readOnlyArguments,IDictionaryService参数,ITypeResolutionService解析)


---内部结束时的coordinationData)


Microsoft.Practices.RecipeFramework.Recipe.UndoExecutedActionsAndRethrow(Exceptio)中的异常堆栈跟踪---


n ex)


at Microsoft.Practices.RecipeFramework.Recipe.ExecuteActions(IDictionaryService readOnlyArguments,IDictionaryService arguments,ITypeResolutionService resolution)


at Microsoft.Practices。 RecipeFramework.Recipe.Execute(Boolean allowSuspend)


at Microsoft.Practices.RecipeFramework.GuidancePackage.Execute(String recipe,IAssetReference reference,IDictionary arguments)


at Microsoft.Practices.RecipeFramework.GuidancePackage.ExecuteFromTemplate(String recipe,IDictionary arguments)


at Microsoft.Practices.RecipeFramework.VisualStudio.Templates.UnfoldTemplate.ExecuteRecipe(Boolean executeActions)


at Microsoft.Practices.RecipeFramework.VisualStudio.Templates.UnfoldTemplate.RunFinished()


所以它搜索我的调试文件夹中的t4文件,但没有我指定此文件夹的地方。

当我尝试使用动作时,我这样做:


< 动作 名称 = " GenerateDataLayer "


类型 = " Microsoft .Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction,Microsoft.Practices.RecipeFramework.VisualStudio.Library " <字体color ="#0000ff"size = 2>


模板 = " SQL \ StoredProceduresGenerator.tt " >


< / 动作 >


将SQL文件夹的父文件夹添加到注册表中。< br>
当我使用vs模板时,我收到此错误,仍然将t4文件放在展开的项目中,当我运行t4文件时,它生成代码没有问题。

有人谁知道解决方案吗?
Thx提前
格伦

解决方
格伦
结果

Hi all,
When i try to unfold a .tt (placed in a vs template) file with gat or when i use the TextTemplateAction to execute the t4 file i get the following error:

Error: 0 : Microsoft.Practices.RecipeFramework.ActionExecutionException: An exception occurred during the binding of reference or execution of recipe CreateDataLayerLibrary. Error was: Action GenerateDataLayer failed to execute:

Could not find a part of the path 'D:\Dev\GSL\SoftwareFactory\Trunk\GAT\RAD\Package\GSL.SoftwareFactory.GAT.Package\bin\Debug\Templates\SQL\StoredProceduresGenerator.tt'..

You can remove the reference to this recipe through the Guidance Package Manager. ---> System.IO.DirectoryNotFoundException: Could not find a part of the path 'D:\Dev\GSL\SoftwareFactory\Trunk\GAT\RAD\Package\GSL.SoftwareFactory.GAT.Package\bin\Debug\Templates\SQL\StoredProceduresGenerator.tt'.

at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)

at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)

at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)

at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize)

at System.IO.StreamReader..ctor(String path, Encoding encoding)

at System.IO.File.ReadAllText(String path, Encoding encoding)

at Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction.Execute()

at Microsoft.Practices.RecipeFramework.Recipe.Microsoft.Practices.RecipeFramework.Services.IActionExecutionService.Execute(String actionName, Dictionary`2 inputValues)

at Microsoft.Practices.RecipeFramework.Recipe.Microsoft.Practices.RecipeFramework.Services.IActionExecutionService.Execute(String actionName)

at Microsoft.Practices.RecipeFramework.Recipe.Microsoft.Practices.RecipeFramework.Services.IActionCoordinationService.Run(Dictionary`2 declaredActions, XmlElement coordinationData)

at Microsoft.Practices.RecipeFramework.Recipe.ExecuteActions(IDictionaryService readOnlyArguments, IDictionaryService arguments, ITypeResolutionService resolution)

--- End of inner exception stack trace ---

at Microsoft.Practices.RecipeFramework.Recipe.UndoExecutedActionsAndRethrow(Exception ex)

at Microsoft.Practices.RecipeFramework.Recipe.ExecuteActions(IDictionaryService readOnlyArguments, IDictionaryService arguments, ITypeResolutionService resolution)

at Microsoft.Practices.RecipeFramework.Recipe.Execute(Boolean allowSuspend)

at Microsoft.Practices.RecipeFramework.GuidancePackage.Execute(String recipe, IAssetReference reference, IDictionary arguments)

at Microsoft.Practices.RecipeFramework.GuidancePackage.ExecuteFromTemplate(String recipe, IDictionary arguments)

at Microsoft.Practices.RecipeFramework.VisualStudio.Templates.UnfoldTemplate.ExecuteRecipe(Boolean executeActions)

at Microsoft.Practices.RecipeFramework.VisualStudio.Templates.UnfoldTemplate.RunFinished()


So it search the t4 file in my debug folder but there is no place i specified this folder.

When i try it with an action i do it this way:

<Action Name="GenerateDataLayer"

Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library"

Template="SQL\StoredProceduresGenerator.tt">

</Action>

The parent folder of the SQL folder is added to the registry.

When i use a vs template, i get this error, still the t4 file is placed in the unfolded project and when i run the t4 file, it generates the code without problems.

Someone who knows the solution for this?
Thx in advance
Glenn

解决方案

Hi Glenn,



这篇关于使用t4时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆