I'm trying to do a fairly simple TF that would generate a list of items, but before I do that I would like to set my DBContext. I'm trying the following:
<#@ template debug="false" hostspecific="false" language="C#" #>
<#@ assembly name="System.Configuration" #>
<#@ assembly name="System.Core" #>
<#@ import namespace="System.Configuration" #>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.Text" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ import namespace="MyProj.Data" #>
<#@ output extension=".cs" #>
namespace ModelGenerator
{
<#
MyProj.Data.ProjectContext db;
#>
}
Compiling transformation: The type or namespace name 'MyProj' could not be found (are you missing a using directive or an assembly reference?)
I'm not sure if I'm doing this right. I'm trying to include the project that has the .EDMX file.
<#@ import namespace="MyProj.Data" #>
In the "MyProj" project has the app.config that has a connection string called "ProjectContext.
I also have a reference in my project that contains the T4 to the MyProj.Data project.
What do I need to do, to get past this error?
Update:
Based off of Yacoub Massad comment. I changed
<#@ import namespace="MyProj.Data" #>
to this:
<#@ assembly name="MyProj.Data" #>
Now I'm getting this error:
Compiling transformation: Metadata file 'MyProj.Data' could not be found