Add Project Reference to the OutputProject

Jan 28, 2011 at 1:37 PM

Hi,

 

I'm using a .tt to generate classes into a different project. These classes use a helperclass in yet another project. I would like my .tt to add a reference to that helper-project but I can't see to figure out how to do this. Am I missing an option or is this not possible?

part of the .tt file:


public class MyTemplate : Template 
{
	public override string TransformText()
	{
		// Add needed references (for the output project), THIS WORKS
		this.Output.References.Add("System");
		this.Output.References.Add("System.Data");

		// Add reference to different project in the solution where the output project resides, THIS FAILS
		this.Output.References.Add("MyHelperProject");

		// THIS WORKS but when you switch the solution from Debug to Release, the reference doesn't update
		this.Output.References.Add(@"c:\MyCode\MySolution\MyHelperProject\Bin\Debug\MyHelperProject.dll");

		// insert the rest of the code here
	}
}