【发布时间】:2014-08-12 23:18:27
【问题描述】:
当在 .tt T4 模板中引用程序集时,我应该能够使用以下声明:
<#@ assembly name="$(SolutionDir)\..\..\Build\lib\HedgehogDevelopment.CodeGeneration.Extensions.dll" #>
据我所知,SolutionDir 没有被转换,我收到一条错误消息(如下)
注意:HedgehogDevelopment.CodeGeneration.Extensions.dll 不能添加到 GAC 或 Visual Studio 程序集文件夹,因为 DLL 需要与项目一起传递。
我不知道TDS代码生成是如何执行的,所以我在这里问一下是否有人解决了类似的问题。
错误 | 10 |主机在尝试解决 装配参考 '$(SolutionDir)......\Build\lib\HedgehogDevelopment.CodeGeneration.Extensions.dll'。 转换将不会运行。
以下异常是 抛出:System.IO.FileLoadException:给定的程序集名称或 代码库无效。 (来自 HRESULT 的异常:0x80131047)在 System.Reflection.AssemblyName.nInit(RuntimeAssembly& 程序集, Boolean for Introspection, Boolean raiseResolveEvent) 在 System.Reflection.AssemblyName..ctor(字符串 assemblyName) 在 Microsoft.VisualStudio.TextTemplating.GlobalAssemblyCacheHelper.GetLocation(字符串 强名)在 Microsoft.VisualStudio.TextTemplating.VSHost.TextTemplatingService.ResolveAssemblyReference(字符串 装配参考)在 Microsoft.VisualStudio.TextTemplating.Engine.ResolveAssemblyReferences(ITextTemplatingEngineHost 主机,TemplateProcessingSession 会话)
【问题讨论】:
-
什么是“TDS”?没听说过,标签wiki是空的。
-
@JohnSaunders Team Develpoment for Sitecore 非常适合 Sitecore 开发。
-
@jammykam:谢谢。我更新了标签 wiki。
-
扩展方法现已移至 T4 文件中。这应该有助于解决您的原始问题。我更新了我的答案以反映这一点。