Welcome Guest! To enable all features please Login or Register.



#1 Posted : Saturday, January 14, 2012 8:04:20 PM(UTC)
Rank: Newbie

Groups: Member
Joined: 1/14/2012(UTC)
Posts: 1
Location: Dortmund


I am trying to generate a T4 for a DSL from the Visual Modelling SDK.

You answered a similar question once but I seem to be having some futher difficulties.

If I add the dsl dll as an assembly (<@ assembly name="my dsl assembly" @>), I get intellisense for the dsl objects. The problem is that I can't run the .tt file because I get the error

Error 3 Compiling transformation: An assembly with the same identity 'Company.TransCTest.Dsl, Version=, Culture=neutral, PublicKeyToken=a2db13597bb475c7' has already been imported. Try removing one of the duplicate references. D:\Users\bla\Documents\Visual Studio 2010\Projects\Tests\DSL\TransCTest\Debugging\TransCTestReport.tt

Is there a workaround for this? Note: I am editing the .tt in my debugging window and the assembly is automatically used, not referenced directly as a dll. Am I missing something?


#2 Posted : Sunday, March 18, 2012 10:42:32 PM(UTC)
Rank: Administration

Groups: Administration
Joined: 3/17/2009(UTC)
Posts: 168

Was thanked: 12 time(s) in 12 post(s)
Hi Ben,

i think the problem is that the DSL.dll is loaded from another location. In case of VS 2010 please do not specify the location of the assembly,
if you are running VS in Exp mode and are debugging the dsl.


<#@ template inherits="Microsoft.VisualStudio.TextTemplating.VSHost.ModelingTextTransformation" #>
<#@ output extension=".txt" #>
<#@ assembly name="Microsoft.VisualStudio.TextTemplating.Modeling.10.0.dll"#>
<#@ MyOwnDSL processor="MyOwnDSLDirectiveProcessor" requires="fileName='Sample.mydsl1'" #>
<#@ assembly name="Company.MyOwnDSL.Dsl.dll"#>
<#@ import namespace="Company.MyOwnDSL"#>
<#@ import namespace="Microsoft.VisualStudio.Modeling" #>
<#@ import namespace="System.Collections.Generic" #>

Generated material. Generating code in C#.


// When you change the DSL Definition, some of the code below may not work.

foreach (ExampleElement element in this.ExampleModel.Elements)
<#= element.Name #>

If you using a DSL someone else created the best you can do is add it to the GAC or install it as VSIX to your extensions folder.
#3 Posted : Sunday, March 18, 2012 11:33:42 PM(UTC)
Rank: Guest

Groups: Guest
Joined: 3/17/2009(UTC)
Posts: 1,084

Was thanked: 1 time(s) in 1 post(s)
Hi all,

I did some more research and found out that the error listed above occurs when the DSL.dll is loaded from a wrong location. The default location in Exp Hive of your DSL looks similar like this:

<#@ assembly name="C:\Users\Tim Fischer\AppData\Local\Microsoft\VisualStudio\10.0Exp\Extensions\Company\MyOwnDSL\\Company.MyOwnDSL.Dsl.dll"#>

Eventually it will also work without any path for you, depending on the packagedef file and installation options for your DSL.

I hope this helps


Users browsing this topic
Guest (3)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF | YAF © 2003-2022, Yet Another Forum.NET
This page was generated in 0.108 seconds.

Authorization on the site

For an authorized user opens up new possibilities