Cannot execute template through custom host

Aug 27, 2009 at 3:41 AM

Hi, 

We are trying to execute the tt file provided by you at http://riaservicescontrib.codeplex.com/ through our custom host code as follows,

            CustomCmdLineHost host = new CustomCmdLineHost();
           Engine engine = new Engine();
           //Transform the text template.
           string output = engine.ProcessTemplate(input, host);

However we need to change the tage 
language="C#v3.5"  to language="C#" else the host hrows an warning. we are usingvs2009 and our projec tatgets 3.5 framework.

1) Currently we cannot execute the tt file as it gives error of the above tag will not be used instead it will use plain c# tag.How to resolve this issue.

2) If we change the tag from c#v3.5 to just c# the error goes but there are other erros like :

t4 error Compiling transformation: The type or namespace name 'Data' does not exist in the namespace 'System' (are you missing an assembly reference?)}

t4 error Compiling transformation: The type or namespace name 'XML' does not exist in the namespace 'System' (are you missing an assembly reference?)}

t4 error Compiling transformation: The type or namespace name 'Entity' does not exist in the namespace 'System' (are you missing an assembly reference?)}

I have included all the required dlls in the tt file still the host gives the error.

Can you please provide us he code of running your tt file through custom host.

Thanks,

Prasad M.

 

 

Coordinator
Aug 27, 2009 at 3:27 PM

I am using C# 3.5 specific features. If you don't have the language set to C#3.5 then it will not work. I have not tried using custom hosts. According to the documentation here it looks like the CustomCmdLineHost has methods to load assemblies. You could try those methods to load the missing assemblies.

Oct 28, 2009 at 4:34 PM
Edited Oct 28, 2009 at 7:12 PM

Prasad did you ever resolve this?  I am having the same issue with another template I am trying to run from my custom host.  The script works fine in VS, but no from my console app.

Colin, I have attempted to load assemblies throught the host, but can't get it to work.

 Terrence

Edit:

error: [0] = {c:\Users\Terrence.MACTEXAS\AppData\Local\Temp\62p7meha.0.cs(2,21) : error CS0234: Compiling transformation: The type or namespace name 'SqlServer' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)}

For those that are trying to create your own custom host by the example on msdn, I was able to solve my errors by using paths in the assembly lines instead of names and versions etc.

This did not work:

<#@ assembly name="Microsoft.SqlServer.Smo, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" #>
<#@ assembly name="Microsoft.SqlServer.ConnectionInfo, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" #>

This worked without error:

<#@ assembly name="C:\Program Files (x86)\Microsoft SQL Server\90\SDK\Assemblies\Microsoft.SqlServer.Smo.dll" #>
<#@ assembly name="C:\Program Files (x86)\Microsoft SQL Server\90\SDK\Assemblies\Microsoft.SqlServer.ConnectionInfo.dll" #>

Oct 29, 2009 at 1:44 PM

I was refering the old version (i guess 8.0)of Microsoft.VisualStudio.TextTemplating.dll. When i refered the newer version i.e 9.0 it solved my problem.

 

Thanks,

Prasad M.

Jul 29, 2010 at 5:48 PM

Hi

I am pretty new to WCF RIA Services. I have doubts in using RIASERVICESCONTRIB.dll in my silverlight ria businesss application where i am not able to see any T4 templates. If anyone could share any blog that describes the steps to use RIASERVICESCONTRIB.dll visually , it will be of great help.Where are the .tt files located

CSBusinessObject.tt: Generates a complete DomainService in C#
VBBusinessObject.tt: Generates a complete DomainService in Visual Basic


CSMetadata.tt: Generates metadata classes in C#
VBMetadata.tt: Generates metadata classes in Visual Basic

CSSharedInterfaces.tt: Generates entity interfaces in C#
VBSharedInterfaces.tt Generates entity interfaces in Visual Basic

 

Please help

Best Regards

Dhinesh Kumar

Coordinator
Aug 23, 2010 at 3:00 PM

Dhinesh, the T4 templates were from early betas of RIA Services and they have been retired. There will be new templates here after RIA Services adds full template support.