Share via


Walkthrough: Adding a Domain-Specific Language Solution to an Isolated Shell

You can add a domain-specific language solution to a Visual Studio shell running in isolated mode. An isolated shell allows you to determine which Visual Studio functionality you need to interact with your domain-specific language and how that solution should appear. For more information about the Visual Studio isolated shell, see Walkthrough: Adding a Domain-Specific Language Solution to an Isolated Shell. You can find more information on customizing the isolated shell in Isolated Shell Extensibility Points

Important noteImportant Note:

If you are planning to deploy your DSL application to computers that do not have the Visual Studio SDK installed, you must obtain a shell load key (SLK) and add it to your shell project. For information about adding an SLK to an isolated shell project, see How to: Add an SLK to an Isolated Shell Project.

Creating an Isolated Shell Solution

In this walkthrough you will learn how to add a DSL solution to an isolated shell project, without customizing the appearance of the isolated shell or restricting its functionality. You can find more detailed information about isolated shell customization in Walkthrough: A Basic Isolated Shell Application.

To create an isolated shell solution

  1. Open Visual Studio as an administrator. In Windows Vista you should open it with elevated privileges.

  2. Create an isolated shell solution. In the Project types window, click Other Project Types, then Extensibility. Click the Visual Studio Shell Isolated project template.

  3. Name the project IsolatedDSL.

  4. Build the solution and start the isolated Shell.

Adding a Domain-Specific Language

You should create a domain-specific language separately before adding it to an isolated shell. For more information about creating a domain-specific language solution, see Walkthrough: Creating a Domain-Specific Language Solution. The following steps will use the sample FamilyTree solution.

To add a DSL solution to an isolated shell

  1. Add both the Dsl project and the DslPackage project of the domain-specific language solution to the IsolatedDSL solution. To use the FamilyTree sample, add the following project files:

    • VSSDKInstallDir\VisualStudioIntegration\Samples\DSLTools\Example.Validation\Example.FamilyTree\Dsl\Dsl.csproj

    • VSSDKInstallDir\VisualStudioIntegration\Samples\DSLTools\Example.Validation\Example.FamilyTree\DslPackage\DslPackage.csproj

  2. Set shell dependencies on both the Dsl and the DslPackage projects. In the Solution Explorer, right-click the IsolatedDSL project and select Shell Dependencies. Select both Dsl and DslPackage.

  3. Build the solution and start the isolated Shell.

  4. Add a file to the solution and name it Example.ftree. You should make sure that the extension is the same as the extension registered for the domain-specific language.

  5. Close the file and reopen it.

    The Domain-Specific Language Designer will open. You will also see the DSL Explorer window, named TestValidation. You can now begin working with the domain-specific language.

Deploying the Domain-Specific Language Isolated Shell

You deploy your domain-specific language isolated shell application to a target computer by creating a Setup project. You must specify the following things:

  • The layout of the folders and files on the target computer.

  • The launch conditions that guarantee that the .NET Framework and Visual Studio Shell runtime are installed on the target computer.

  • Custom actions to install and uninstall the custom isolated shell application.

To create the Setup project

  1. In Solution Explorer, right-click the solution node and then click Add New Project.The New Project dialog box appears.

  2. In the Project types window, expand Other Project Types and then click Setup and Deployment. Click the Setup Project template. Name the new project MySetup and then click OK.The wizard creates the Setup project and adds it to the solution.

In the next step, you will lay out the files for the setup program to look like the directory structure of the IsolatedDsl\Release folder.

To lay out the files and folders on the target computer

  1. Right-click the MySetup project and then click Add, then Project Output.

    The Add Project Output Group dialog box appears.

  2. Select IsolatedDsl in the Project drop-down list and (Active) in the Configuration drop-down list.

  3. Select Primary Output in the list box and then click OK.

    Primary Output from IsolatedDsl (Active) is added to the project.

  4. Repeat the preceding three steps for the IsolatedDslUI, Dsl, and DslPackage projects.

    Note

    You may see a warning that some dependencies cannot be determined automatically. Press OK to accept the suggested dependencies.

  5. Exclude all the items from the MySetup\DetectedDependencies node.

  6. Right-click the MySetup project and then click View, then File System. The File System (MySetup) window appears.

  7. In the File System (MySetup) window, right-click Application Folder, then Add, then File. Select the file:

    IsolatedDsl\Release\IsolatedDsl.exe.config.

  8. Right-click the MySetup project and then click Add, then Folder. Name the new folder PackagesToLoad.

  9. Select Primary output from Dsl (Active) and Primary output from DslPackage (Active) under Application Folder and move them under the PackagesToLoad folder.

  10. Right-click the PackagesToLoad folder and then click Add, then File. Select the following files:

    • IsolatedDsl\Release\PackagesToLoad\IsolatedDsl.pkgdef

    • IsolatedDsl\Release\PackagesToLoad\IsolatedDsl.pkgundef

    • IsolatedDsl\Release\PackagesToLoad\Fabrikam.DSL.TestValidation.DslPackage.pkgdef

  11. Right-click the PackagesToLoad folder and then click Add, then Folder. Name the folder 1033.

  12. Move Primary Output from IsolatedDslUI (Active) from the Application Folder to the 1033 folder.

  13. The schema file needs to be installed in the main Visual Studio schema directory. Right-click on File System on Target Machine and select Add Special Folder, then Program Files Folder.

  14. Under the Program Files folder add a folder named Microsoft Visual Studio 9.0.

  15. Under the Microsoft Visual Studio 9.0 folder add a folder named Xml.

  16. Under the Xml folder add a folder named Schemas.

  17. Under the Schemas folder add the following file:

    IsolatedDsl\Release\PackagesToLoad\GeneratedCode\TestValidationSchema.xsd.

To specify the launch conditions

  1. Open the MySetup project in the Launch Conditions editor.

  2. Right-click the Search Target Machine folder and then click Add Registry Search.

  3. Right-click the new search entry to open the Properties Window, and then set the following values for the given properties.

    • (Name)
      Search for Visual Studio Registration.

    • Property
      VSINSTALLDIR

    • RegKey
      Software\Microsoft\VisualStudio\9.0

    • Root
      vsdrrHKLM

    • Value
      InstallDir

    Note

    If the InstallDir key is present, you can assume that the Visual Studio Shell runtime is installed on the target computer.

  4. Right-click the Launch Conditions folder and then click Add Launch Condition.

Right-click the new search entry to open the Properties window, and then set the following values for the given properties.

  • (Name)
    CheckForVS

  • Condition
    VSINSTALLDIR<>

  • InstallUrl

  • Message
    Install VS Shell Isolated

To create the Setup project custom actions

  1. Right-click the MySetup project and then click Custom Actions.

  2. Right-click the Install folder and then click Add Custom Action.The Select Item in Project dialog box appears.

  3. Double-click the Application Folder to open it.

  4. Double-click Primary Output from IsolatedDsl (Active).The Custom Actions editor reappears.

  5. Select Primary Output from IsolatedDsl (Active).

  6. Open the Properties Window and set the following values for the given properties.

    • (Name)
      Primary Output from IsolatedDsl (Active)

    • Arguments
      /setup

    • Condition

    • CustomActionData

    • InstallerClass
      False

  7. Right-click the Uninstall folder and then click Add Custom Action.The Select Item in Project dialog box appears.

  8. Double-click Application Folder to open it.

  9. Double-click Primary Output from IsolatedDsl (Active).The Custom Actions editor reappears.

  10. Select Primary Output from IsolatedDsl (Active).

  11. Open the Properties Window and set the following values for the given properties.

    • (Name)
      Primary Output from IsolatedDsl (Active)

    • Arguments
      /remove

    • Condition

    • CustomActionData

    • InstallerClass
      False

  12. Build the MySetup project. Doing this produces a MySetup.msi file and a setup.exe file in the Release output directory of the project. If the other projects are out of date, they are rebuilt.

Testing the Installation Program

After you rebuild the Setup project, you should find two files, MySetup.msi and setup.exe, in the Release folder of the MySetup project. To test them, copy them to a different computer and run the Setup executable. The Setup program should install the isolated shell, and you should be able to run it.

You may install your isolated shell application on any computer that has the release version of Visual Studio 2008 or the Visual Studio 2008 Shell (isolated mode) Redistributable Package. Do not try to install the application on computers that have a pre-release version of Visual Studio 2008.

Change History

Date

History

Reason

July 2008

Rewrote and refactored project.

Content bug fix.