MVC プロジェクトを作成し、「Class1.cs」を (同じプロジェクト内に) Class1 コードに追加しました。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using MvcApplication2.Models;
namespace MvcApplication2
{
public class EntityAttribute
{
public string Name { get; set; }
}
public class Entity
{
public List<EntityAttribute> Attributes { get; set; }
public string Name { get; set; }
}
public class Class1
{
public static string getTable()
{
return "tbl";
}
}
}
テキスト テンプレート ファイル .tt があります。
<#@ template debug="true" language="C#" #>
<#@ output extension=".cs" #>
<#@ assembly name="$(SolutionDir)\MvcApplication2\bin\MvcApplication2.dll" #>
<#@ import namespace="MvcApplication2" #>
<#
string s = Class1.getTable();
#>
TextTemplate で CustomTool を実行すると、次のエラーが発生します。
Error 2 Compiling transformation: Metadata file 'MvcApplication2.dll' could not be found C:\Users\Igor\Documents\Visual Studio 2010\Projects\MvcApplication2\MvcApplication2\TextTemplate1.tt 1 1 MvcApplication2
" <#@ assembly name="MvcApplication2.dll" #> " をフルパス " <#@ assembly name="C:\Users\Igor\Documents\Visual Studio 2010\Projects\MvcApplication2\MvcApplication2\bin\ に変更するとMvcApplication2.dll" #> "
次のエラーが表示されます。
Error 2 Compiling transformation: 'MvcApplication2.Class1' does not contain a definition for 'getTable' c:\Users\Igor\Documents\Visual Studio 2010\Projects\MvcApplication2\MvcApplication2\TextTemplate1.tt 8 20
私の間違いはどこですか?? ありがとうございました