On this page....
Archives
<December 2008>
SunMonTueWedThuFriSat
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

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
# Tuesday, December 02, 2008
« DSL and Visual Studio Shell tutorial: Cr... | Main |

This post is part of a larger tutorial on DSL Tools and Visual Studio 2008 Isolated Shell, in this post I will go through the steps to setup project for the Shell application and DSL.

Previous step: Creating a custom project type

Creating a new setup project

We will start by adding a new setup project to our solution, so start by opening the solution from the previous post, if not already open.

1. New Project

Create a new Setup Project named “MyDslApplication”, by right-clicking the solution in the Solution Explorer and choosing Add New Project.

In the Add New Project choose Setup Project as shown below:

The solution should now look as shown below:

2. Set project properties

In the setup projects properties set Author and Manufacturer to “MyCompany” as shown below.

Adding output files

Now we are going to add assemblies and other files to the setup project, so you should now open the “File System” in the setup project. Right-click the setup project, MyDslApplication, in the Solution Explorer and choose View -> File System on the context menu.

1. Shell output

Add the Primary Output from the “MyDslShell” project (this will be the actual executable MyDslShell.exe) to the Application Folder.

Right-click the Application Folder, in the File System view, and choose and Add -> Project Output… from the context menu. Then select the “MyDslShell” project, Primary Output and Active configuration as shown below.

The solution should now look as shown below.

2. Add Shell config, icon and splash screen image

Add the following files from the folder “D:\project\DslToolsAndVsShell\Code\MyDSLApplication\MyDslShell\MyDslShell” to the Application Folder:

  • MyDslShell.exe.config
  • MyDslShell.ico
  • Splash.bmp
  • MyDslShell.prf

Right-click the Application Folder, in the File System view, and choose and Add -> File… from the context menu. Then select the files as shown below.

After this your solution should look as shown below.

3. Add PackagesToLoad and template folders

Add the following folders under the Application Folder:

  • ItemTemplates
  • ItemTemplatesCache
  • ProjectTemplates
  • ProjectTemplatesCache
  • Profiles
  • PackagesToLoad

And a folder named “1033” under the new “PackagesToLoad” folder.

Right-click the Application Folder or a subfolder, in the File System view, and choose and Add -> Folder from the context menu to add a folder.

Mark the “ItemTemplates”, “ItemTemplatesCache”, “ProjectTemplates” and “ProjectTemplatesCache” folders with the AlwaysCreate option as shown below

4. Add Shell UI output

Add the Primary Output from MyDslShellUI to the “1033” folder.

After adding the Shell UI output the solution should look as shown below.

5. Add DSL package output

Add the Primary Output from the “DslPackage” project to the “PackagesToLoad” folder

After adding the DSL package output the solution should look as shown below. Note that a lot of dependencies will be added, you can just ignore them for now.

6. Add MyDslProject output

Add the Primary Output from the “MyDslProject” project to the “PackagesToLoad” folder.

After adding the DSL project output the solution should look as shown below.

7. Exclude unwanted dependencies

Most of the dependencies that were added when adding the DslPackage and MyDslProject output need to be excluded. The only dependency you will want to keep is “MyCompany.MyDsl.Dsl.dll”.

In the Solution Explorer select all the dependencies to excluded as shown below and select exclude on the context menu.

The solution should now look as the solution shown below

8. Add pkgdef files

Add the “MyDslShell.pkgdef “ and “MyDslShell.pkgundef” from the folder “D:\project\DslToolsAndVsShell\Code\MyDSLApplication\MyDslShell\MyDslShell” to the “PackagesToLoad” folder

Your solution should now look as shown below.

9. Add pkgdef for project and dsl packages

Add the “MyCompany.MyDsl.DslPackage.pkgdef “ and “MyDslProject.pkgdef” from the folder “D:\project\DslToolsAndVsShell\Code\MyDSLApplication\Debug\PackagesToLoad” to the “PackagesToLoad” folder.

Please note that the file is taken from the “Debug” (not the “Release” folder”), this is not an optimal solution. The file should actually be taken from the active configuration output folder, but I could not find an easy way of doing this, so for now just use the Debug or Release folder as you like –it the same file.

Your solution should now look as shown below.

10. Add project template

Add the project template file “MyDslProject.zip” from the “D:\project\DslToolsAndVsShell\Code\MyDSLApplication\Debug\ProjectTemplates” folder to “ProjectTemplates”.

Your solution should now look as shown below.

11. Add profile file

Add the Visual Studio settings file “General.vssettings” from the “D:\project\DslToolsAndVsShell\Code\MyDSLApplication\MyDslShell\MyDslShell” folder to “Profiles”.

Your solution should now look as shown below.

12. Adding the DSL schema

You need to add the XML schema for your DSL, otherwise you will get a warning when running the application. This has to be placed in “C:\Program Files\Microsoft Visual Studio 9.0\Xml\Schemas”, even when we use the isolated shell.

Add the “Program Files” folder to your solution as shown below, by right-clicking the “File System on Target Machine” and choose Add Special Folder -> Program Files Folder

Under the Program Files folder add a folder named “Microsoft Visual Studio 9.0”, under this folder add a folder named “Xml” and under this folder add a folder named “Schemas”.

Add the file “MyDslSchema.xsd” from “D:\project\DslToolsAndVsShell\Code\MyDSLApplication\MyDsl\Dsl\GeneratedCode” to the newly created “Schemas” folder.

Your solution should now look as shown below.

13. Adding a start menu folder

Under “User’s Programs Menu” add a new folder named “MyCompany” and within that folder create a new folder named “MyDsl”.

14. Add a start menu shortcut

In the “MyDsl” folder, under the start menu, create a new shortcut pointing to the Shell executable.

And choose the primary output from the "MyDslShell" project

Name the shortcut “MyDslShell” as shown below

Choose the icon, “MyDslShell.ico”, in the Application Folder

Adding a launch conditions

Add a launch condition to ensure that Visual Studio 2008 isolated shell is installed before installing our application

1. Add registry search

Fill in the following values:

Name: Search for Visual Studio Registration
Property: VSINSTALLDIR
RegKey: Software\Microsoft\VisualStudio\9.0
Root: vsdrrHKLM
Value: InstallDir

Your solution should look as shown below.

2. Add launch condition

Fill in the following values:

Name: CheckForVS
Condition: VSINSTALLDIR<>""
Install URL: http://www.microsoft.com/DOWNLOADS/details.aspx?FamilyID=021b3bee-b2ad-42a8-854a-c5eaef69e927&displaylang=en
Message: Install VS Shell Isolated SP1

Your solution should look as shown below.

Adding custom actions

During installation and uninstallation it is necessary to execute the shell application with some options to register and unregister its components. This is done by adding two custom actions to the installation.

1. Add setup custom action

Right-click the Install node and choose Add custom action…. In the Select Item in Project dialog choose the primary output from “MyDslShell” in the Application Folder.

After adding the action specify “/setup” as arguments in the properties window.

2. Add remove custom action

Right-click the Uninstall node and choose Add custom action…. In the Select Item in Project dialog choose the primary output from “MyDslShell” in the Application Folder

After adding the action specify “/remove” as arguments in the properties window.

Build and Test

Finally you are ready to test the entire solution, so just build and try out the installationv

1. Rebuild the setup project “MyDslApplication”

2. Install the application

Run the “setup.exe” from the folder “D:\project\DslToolsAndVsShell\Code\MyDSLApplication\MyDslApplication\Debug”

Just press next and install the application using its default settings

3. Run the application

Start the application from the Windows Start menu

You should now see your application

Now try to open the New Project dialog and should hopefully show your Dsl project as shown below

Create a new project and try out your application

Summary

This is the end of this tutorial, you have a running DSL application that can be redistributes, but there are still some things to do:

Download: DslToolsAndVsShell-06.zip (12 MB)

What next?

  • Make a new splash screen image
  • Remove menu items not relevant to your application
  • And other details like adding an About box
Tuesday, December 02, 2008 10:00:17 PM (Romance Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [80]  |