Visual Studio Development Bookmark and Share   
 index > Visual Studio Guidance Automation Toolkit > How to import current project reference in T4 template
 

How to import current project reference in T4 template

Hi,

In my t4 template i try to reference his projet.

If i try like this :

<#@ assembly name="C:\Documents and Settings\user.xx\Mes documents\Visual Studio 2008\Projects\SilverlightTutorials\ProjectNameX\Bin\Debug\ProjectNameX.dll"
 #>
<#@ import namespace="ProjectNameX.MyClass" #>

After the first T4 generation, i can't build my project : dll can't be replaced, the T4 template use it.

Is there anyway to do this unless copy my dll in another folder and reference it ?

My goal is to do a "typeof(MyClass).GetEvents()" instruction in my T4 template where "MyClass" is a part of a service reference generated by VS 2008.

thanks
Ozanges  Tuesday, August 18, 2009 8:51 AM
T4 will lock any assembly a template references during transformation process. You can work around the problem by closing and reopening the solution.Copying the dll to another location doesn't help when you need to rebuild your assembly and regenerate the code from it. The better options are Introspection or CodeModel, which allow you to use the class metadata without locking the assembly.
Oleg
  • Marked As Answer byOzanges Tuesday, August 18, 2009 4:40 PM
  •  
Oleg V. Sych  Tuesday, August 18, 2009 12:30 PM
T4 will lock any assembly a template references during transformation process. You can work around the problem by closing and reopening the solution.Copying the dll to another location doesn't help when you need to rebuild your assembly and regenerate the code from it. The better options are Introspection or CodeModel, which allow you to use the class metadata without locking the assembly.
Oleg
  • Marked As Answer byOzanges Tuesday, August 18, 2009 4:40 PM
  •  
Oleg V. Sych  Tuesday, August 18, 2009 12:30 PM
Thank you Oleg for your complete answer.

Ozanges  Tuesday, August 18, 2009 4:44 PM

You can use google to search for other answers

Custom Search

More Threads

• How do you pass arguments from previous wizard pages
• exception in execution of recipe
• UnfoldTemplateAction - with template parameter
• GAX/GAT for VS 2005-2008 default templates removed
• Automated Testing
• Help needed in creating an installer for the guidance package which I've created
• How to find a NULL in a dataset ?
• GAT/GAX Automated build for TFS
• Unsupported version of Microsoft Visual C# 3.0 / Microsoft Visual Basic 9.0
• <ProjectGuid>{$WebGuidProp$}</ProjectGuid> Ignored -- very stragne behaviour