VS2010 下T4引用程序集,未能找到元数据文件(xxx.dll could not be found)

VS2010 下 T4使用
<#@ assembly name="System.Data.SQLite.dll" #>
可以能出现下述错误
Error    3    Compiling transformation: 未能找到元数据文件“System.Data.SQLite.dll”   
问题原因:
http://blogs.msdn.com/garethj/archive/2010/04/15/what-s-new-in-t4-in-visual-studio-2010.aspx
T4's assembly set is completely separated from the containing project's assembly set to avoid picking up the wrong assemblies when a project targets previous framework versions. Project assemblies are no longer used to resolve template assembly directives.

为了避免因为项目与模板在.net framework 版本不一致上引发程序集错误,T4 的程序集已经完全独立于所在项目的程序集。项目的程序集不再直接影响模板的程序集。

这里提供了5种解决方案
http://weblogs.asp.net/lhunt/archive/2010/05/04/t4-template-error-assembly-directive-cannot-locate-referenced-assembly-in-visual-studio-2010-project.aspx

  1. GAC your assemblies and use Namespace Reference or Fully Qualified Type Name
  2. Use a hard-coded Fully Qualified UNC path
  3. Copy assembly to Visual Studio "Public Assemblies Folder" and use Namespace Reference or Fully Qualified Type Name.

    注如:D:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies,拷进去之后需要重启vs2010.

  4. Use or Define a Windows Environment Variable to build a Fully Qualified UNC path.
  5. Use a Visual Studio Macro to build a Fully Qualified UNC path.

转载于:https://www.cnblogs.com/donhwa/archive/2010/10/27/1862116.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值