I created MVC project and added "Class1.cs" to it(in the same project) Class1 code:
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";
}
}
}
I have Text Template file .tt:
<#@ template debug="true" language="C#" #>
<#@ output extension=".cs" #>
<#@ assembly name="$(SolutionDir)\MvcApplication2\bin\MvcApplication2.dll" #>
<#@ import namespace="MvcApplication2" #>
<#
string s = Class1.getTable();
#>
When I run CustomTool on TextTemplate I get the following error:
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
When I change "<#@ assembly name="MvcApplication2.dll" #>" to full path "<#@ assembly name="C:\Users\Igor\Documents\Visual Studio 2010\Projects\MvcApplication2\MvcApplication2\bin\MvcApplication2.dll" #>"
I get the following error:
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
Where is my mistake?? Thank you