gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 21:35:39 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