2010-05-12 78 views
1

我已經在可以添加程序集引用的T4MVC模板文件(.tt)中找到最靠近頂部的位置,像:如何從t4mvc模板(.tt)添加不在GAC中的程序集的引用

<#@ assembly name="System.Core" #> 
<#@ import namespace="System.Collections.Generic" #> 

但是,似乎我只能引用GAC中的程序集。也就是說,如果我有一個裝配MyProject.Stuff.dll(不是在GAC)添加到包含模板的VS項目的引用,然後我希望能夠添加類似以下內容:

<#@ assembly name="MyProject.Stuff" #> 
<#@ import namespace="MyProject.Stuff" #> 

如果我做到這一點,然後我得到以下錯誤:

Error 1 Compiling transformation: Metadata file 'MyProject.Stuff' could not be found C:\Work\Development\DotNetSolution\MyProject\Utils\T4MVC\T4MVC.tt 1 1

如何添加對不在GAC中的程序集的引用?

+0

這是2008年還是2010年? – 2010-05-14 22:55:53

回答

0

假設您使用2010年,這是因爲加載行爲已更改。以下博客文章解釋了變更和解決方法:http://weblogs.asp.net/lhunt/archive/2010/05/04/t4-template-error-assembly-directive-cannot-locate-referenced-assembly-in-visual-studio-2010-project.aspx

+0

這回答我的問題,歡呼。 – stephen 2010-05-27 10:32:46

+0

-1:當鏈接死亡時,你的答案就消失了。 – xr280xr 2014-06-11 16:25:35

+0

似乎整個weblogs.asp.net目前都在運行,其中包括http://weblogs.asp.net/scottgu等主要網站。放鬆,我相信它會回來:) – 2014-06-11 20:52:34

相關問題