【问题标题】:t4 Debuging: ReflectionTypeLoadException "Unable to load one or more of the requested types"t4 调试:ReflectionTypeLoadException“无法加载一种或多种请求的类型”
【发布时间】:2015-08-19 17:36:48
【问题描述】:

我有一个自定义 T4 模板。当我右键单击并选择“运行自定义工具”时,它运行没有错误。如果我右键单击并选择“调试 T4 模板”,我会收到上面的错误,并添加了

=== Pre-bind state information ===
LOG: DisplayName = My.Interfaces, Version=1.0.5708.24057, Culture=neutral, PublicKeyToken=null
 (Fully-specified)
LOG: Appbase = file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/My.Interfaces.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/My.Interfaces/My.Interfaces.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/My.Interfaces.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/My.Interfaces/My.Interfaces.EXE.

我正在使用具有从 c:... 到 dll 的完全限定有效路径的“Assembly”指令。

<#@ Assembly Name="C:\...\MY.Interfaces.dll" #>

再次在不调试时不会出错。

我的问题是如何让调试器正确导入程序集而不将其复制到“IDE”目录?

【问题讨论】:

    标签: visual-studio-2015 t4


    【解决方案1】:

    我引用的 dll 似乎是错误的版本。它位于同一解决方案中项目的 bin 目录中。我更新了 dll 并重建了该项目。然后它就可以工作了,无需将 dll 放在其他任何地方。

    :\

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-07-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-20
      • 1970-01-01
      • 2021-06-23
      相关资源
      最近更新 更多