On this page....
Archives
<September 2008>
SunMonTueWedThuFriSat
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

Feed your aggregator (RSS 2.0)
Search
Categories
About

My LinkedIn profile

Powered by: newtelligence dasBlog 2.1.8102.813

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2012, Christian Bækdorf

Send mail to the author(s) E-mail



Sign In
# Saturday, September 27, 2008
« DSL and Visual Studio Shell tutorial: Pr... | Main | DSL and Visual Studio Shell tutorial: Cr... »

Note: This post is part of a larger tutorial on DSL Tools and Visual Studio 2008 Isolated Shell, in this post I will go through creating a sample DSL that can be used for hosting in Visual Studio 2008 shell.

Previous step: Prerequisites and Initial tasks

Creating a new DSL

We will start by creating a new DSL designer based on one of the standard templates. It’s is not the intention of this guide to describe how to develop DSL’s, so for the purpose of this guide we will just use the DSL as it is.

1. New project

In Visual Studio 2008, create a new DSL designer and place it in the MyDSLApplication folder (e.g. D:\project\DslToolsAndVsShell\Code\ MyDSLApplication). Name the DSL ”MyDsl”

2. Choose language type and name

Use the minimal language for this sample and name the DSL “MyDsl”.

3. Choose file extension and icon

Just accept the default file extension and icon. Please note that we will need to use the extension later, so if you use a different extension you will also have to use that later.

4. Choose product and company name

Specify a company name (we are going to use this later). Only use A-Z, space and 0-9 characters in the names.

5. Strong naming

Just create a new strong naming key.

6. Confirm project settings

Just accept the settings

7. Project creation result

Now you should have a solution as shown below.

Your folder structure should now look as shown below.

8. Testing the DSL

Test the language by starting it using F5. When running you should see something like this.

Adding a Package Load Key (PLK)

If we are going to distribute the final DSL application to users who don’t have Visual Studio 2008 and Visual Studio 2008 SDK installed, we need to provide a Package Load Key (PLK) for our DSL.

You can learn more about VSPackage Load Keys on MSDN: VSPackage Load Keys

1. Gathering necessary information for obtaining a PLK

To obtain a PLK you will need the following information:

  • Company name
  • Package name
  • Package Guid
  • Package version

The information can be found in DslPackage project under GeneratedCode/Constants.tt/Constants.cs

2. Obtaining a Package Load Key (PLK)

You can obtain a Package Load Key (PLK) from MSDN: Generate Load Keys

Enter the information from the Constants.cs, choose “Standard” as Min. Product Edition and “Visual Studio 2008” as min. VS Version. Finally press “Generate PLK”.

3. Adding the Package Load Key (PLK) to DSL

We have to add the PLK to the “DslPackage” projects resource file “VSPackage.resx”. Give it a Name, e.g. 120, and add the key without any newlines.

Next go to the “Package.tt” file and add the following line as shown on the screen dump below:

[VSShell::ProvideLoadKey("Standard", Constants.ProductVersion, Constants.ProductName, Constants.CompanyName, 120)]

Run “Transform All” and rebuild the solution.

Testing the Package Load Key (PLK)

1. Adding the NoVSIP option

To test the PLK you have to add the /NoVSIP option to the debugging startup parameter. This will make Visual Studio perform the PLK validation even when you have you have Visual Studio SDK installed.

Add the option to the Dsl project.

Add the option to the DslPackage project.

2. Running and validating the DSL

Now rebuild the solution and try to run the DSL using F5

If everything is ok you should see you DSL again, as show below.

Please check the output window and look for the following message: “VSIP: Developer edition disabled, normal security checks initiated.”

If you see this message, it means that Visual Studio is validating the PLK.

Summary

This ends the second post about creating a sample DSL, next step is about creating the Visual Studio 2008 Shell application.

Next step: Creating the Shell application

Download: DslToolsAndVsShell-02.zip (1,04 MB)

Saturday, September 27, 2008 9:40:27 AM (Romance Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [82]  |