DSL Tools tip #2: When the wizard won’t run

One or two people are coming across this gotcha, so I thought I’d post.
In order for the Domain Specific Language Designer wizard to work, you have to run it from a regular version of Visual Studio, not the VSIP “Exp” version.
If you use the “Exp” version you’ll get an error along the lines of “Class not registered. Looking for an object with CLSID: {3E55345B…00A1}.”
Some background – when you install VSIP, it creates an experimental or “Exp” registry section and a bunch of shortcuts to run Visual Studio using this experimental registry.  This allows you to test your new VSIP packages in a somewhat sandboxed environment without destroying your basic development environment when things go wrong – it’s a very neat system.
However, these new shortcuts are actually rather more prominent on the desktop and start menu than Visual Studio’s normal shortcut, so its very easy to launch one of them without realising what you’re doing – especially if you are new to VSIP as many people who are downloading our DSL Tools are.
Comments (11)

  1. Can the DSL tools actually code gen yet or is that for the following week? I noticed I can run the language debug project and use it’s designer, but whenever I assign the Custom Tool property, code generation always fails.

    The report code generation works fine when creating the "Full.xyz" file though.

  2. Aaron

    Yes, the code generation is working if the report generation is working from full.xyz

    Code and text are all the same to our generation engine (we should really call it an artefact generation engine).

    When you say code generation always fails, are you assigning the custom tool property to a hand=created generation template of your own? is so, (a) could you post the template somewhere and (b) what do you get in both VS errors list and as a generated file?

  3. I guess maybe I don’t quite grasp the DSL tools quite yet. What I did was create a new language project using the sample that was included in the Wizard. I then hit F5 to compile and run the debug project. I then added the "Full" file to the debug project and dragged a couple of the symbols to the canvas. Then I ran the custom tool on the report file and it created a valid output text file.

    At this point, I used the same Custom Tool setting for the report and added it to the Full file canvas which then failed to code generate.

    No other changes were made to the source projects.

    From your comments, am I correct that I have to create my own code generators for my ObjectModel project that inherit from StandardTemplatedCodeGenerator?

  4. Nope, you don’t need to write anything – the generated project has a basic code generator included in it (in the CodeGen directory in the Designer project).

    There are at least two inputs to every artefact (code/report/whatever) generation.

    1. An artefact template file

    2. Some parameterization – in our case, usually a model file.

    So in the case of the report, the artefact template is the file that is the container in Visual Studio’s solution explorer (its extension doesn’t really matter) and that has the "Custom Tool" set on it in the property grid.

    The parameterization meanwhile is specified in a directive at the top of the artefact template file. This will look something like…

    "<%@ model file="Full.xyz">"

    … which is telling the engine to read in the model file Full.xyz and make its contents available to embedded code in the template via the context variable.

    The output is generated as a file accessed by expanding the artefact template file container when "Show all files" is on.

    So to do your own generation, what you need to do is to add your own artefact template file (lets say Aaron.arttem) and in it reference Full.xyz (or any other model file). Then set the custom tool property on Aaron.arttem to the name of your code generator (the same name as is set on the report’s template).

    Now fill your template with whatever text you want to generate (interspersed with template code).

    Hopefully this should get you going.

  5. That explains it. Thanks!

  6. CesarGon says:

    I am getting a different kind of problem. I installed VSIP and then the December release of DSL tools. I create a new DSL project, the wizard appears, asks a few questions, I hit OK and it starts working… After a few seconds a dialog pops up on screen saying "The template specified cannot be found. Please check that the full path is correct." and then no solution is loaded in Visual Studio. When I examine my directories, I can see that some stuff has been created, but I am not sure if it is functional.

    Any ideas? Thanks.

  7. GarethJ says:

    This sounds like you don’t have Visual C++ installed?

    The solution we generate has two Visual C# projects for the code and one Visual C++ project for the satellite DLL.

    All are currently required – in (much) later builds we hope to migrate to a pure Visual C# solution.

    Is that the problem?

  8. Any updates on when new articles or walkthroughs might be available?

  9. CesarGon says:

    I don’t have Visual C++ installed. Let me try once I install it.