gpt4 book ai didi

sitecore - 通过 TDS 生成代码时未转换 Visual Studio 变量

转载 作者:行者123 更新时间:2023-12-02 04:38:15 24 4
gpt4 key购买 nike

在 .tt T4 模板中引用程序集时,我应该能够使用以下声明:

<#@ assembly name="$(SolutionDir)\..\..\Build\lib\HedgehogDevelopment.CodeGeneration.Extensions.dll" #>

据我所知,SolutionDir 没有被转换,我收到一条错误消息(如下)

注意 HedgehogDevelopment.CodeGeneration.Extensions.dll 不能添加到 GAC 或 Visual Studio 程序集文件夹,因为 DLL 需要随项目一起传递。

我不知道TDS代码生成是怎么执行的,所以在这里问一下,看看有没有人解决过类似的问题。

Error | 10 |The host threw an exception while trying to resolve the assembly reference '$(SolutionDir)......\Build\lib\HedgehogDevelopment.CodeGeneration.Extensions.dll'. The transformation will not be run.

The following Exception was thrown: System.IO.FileLoadException: The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047) at System.Reflection.AssemblyName.nInit(RuntimeAssembly& assembly, Boolean forIntrospection, Boolean raiseResolveEvent) at System.Reflection.AssemblyName..ctor(String assemblyName) at Microsoft.VisualStudio.TextTemplating.GlobalAssemblyCacheHelper.GetLocation(String strongName) at Microsoft.VisualStudio.TextTemplating.VSHost.TextTemplatingService.ResolveAssemblyReference(String assemblyReference) at Microsoft.VisualStudio.TextTemplating.Engine.ResolveAssemblyReferences(ITextTemplatingEngineHost host, TemplateProcessingSession session)

最佳答案

确保将 HedgehogDevelopment.CodeGeneration.Extensions.dll 添加到 GAC 或 Visual Studio Assemblies 文件夹中:

https://github.com/HedgehogDevelopment/tds-codegen/wiki/Using-Extension-Methods

或者在指令中使用程序集的完整路径。

更新:

作为对此的更新,扩展方法 have now been moved到 T4 文件中,因此您不再需要将 DLL 部署到 GAC 或 Visual Studio 文件夹中。您可以找到 updated files in the Github repo .

关于sitecore - 通过 TDS 生成代码时未转换 Visual Studio 变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21439299/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com