Export (0) Print
Expand All

How to: Create a Custom Application to "Run" a SetupApplication Model Instance

[This content is no longer valid. For the latest information on "M", "Quadrant", SQL Server Modeling Services, and the Repository, see the Model Citizen blog.]

This is the fifth of five tasks that create a data-driven application by using the SQL Server Modeling CTP. For an overview of this tutorial, see Getting Started with the SQL Server Modeling CTP (SetupApplication Tutorial).

Both the model of a setup application and an instance of that model are now in the SetupApplicationDB database. At this point, you could create the data-driven application by using any language or development tool that can access SQL Server. In this topic, you download a sample data-driven application named RepInst that uses the SetupApplication model. This saves time and maintains a stronger focus on the SQL Server Modeling CTP technologies in the tutorial.

RepInst.exe reads the model data from the SetupApplicationDB database, uses this information to create an .msi setup file, and launches this setup to install the application that is defined by the targeted model instance. For more information about how to add the model instance data to the database, see How to: Add Model Instances using "M".

The RepInst sample application uses the Windows Installer XML (WiX) v3 toolset to convert the SetupApplication model into an .msi file. WiX is an open-source technology that builds Windows Installer packages from XML files. WiX is not a part of the SQL Server Modeling CTP technologies; it is an implementation choice for this application sample. For more information, see Windows Installer XML (WiX) toolset.

To install the Windows Installer XML (WiX) toolset

  1. Download the Windows Installer XML toolset. In the list of files, expand the WiX v3.0 (stable) folder and then expand the 3.0.5419.0 RTM folder. Choose the setup .zip file in that folder that matches your computer architecture. For example, if you're running on an x86 computer, you would select the Wix3.0.5419.0-x86-setup.zip file.

    Download WiX v3

  2. Extract the Wix.msi file to your local machine.

  3. Launch the Wix.msi setup file to install the WiX toolset.

  4. Follow the instructions in the setup.

To build the RepInst.exe sample application

  1. Obtain the sample Visual Studio 2010 RepInst sample application.

    Download the RepInst sample

  2. Create a subdirectory named RepInst_Sample in the tutorial directory. For example, if you used the suggested tutorial directory of C:\SetupApplication, use the path C:\SetupApplication\RepInst_Sample for the solution location.

  3. Extract the project from the .zip file to the RepInst_Sample directory.

  4. Open the RepInst.csproj project file in Visual Studio 2010.

  5. In Solution Explorer, open the App.Config file.

  6. If necessary, change the paths for the candlePath setting and the lightPath setting to match the location of the WiX toolset on your machine.

  7. In the same App.Config file, confirm that the TargetDatabase connection string is correct. It is set to the SetupApplicationDB database on the local machine.

  8. On the Build menu, click Build Solution.

To create and run the MyNotepad setup application using RepInst.exe

  1. From the Start Menu, click Run.

  2. In the Run dialog, type cmd. Click the OK button to open a command prompt window.

  3. Navigate to the RepInst solution directory, C:\SetupApplication\RepInst_Sample.

    cd C:\SetupApplication\RepInst_Sample
    
  4. Navigate to the Bin\Debug directory, containing the RepInst.exe application.

    cd bin\Debug
    
  5. Run the RepInst.exe application with a parameter of 1, the identifier for the product to install. This will create and run a temporary .msi file from the information in the MyNotepad model instance.

    RepInst.exe 1
    
    Dd861741.note(en-us,VS.85).gifNote:
    The parameter 1 corresponds to the Id of the product to install from the [SetupApplication].[Products] table. Assuming that the MyNotepad instance was the first product added to the SetupApplication model, this identifier will be appropriate for this task.

  6. Verify that the product successfully installed by navigating to the new product directory.

    cd "c:\Program Files\MyNotepad Corp\My NotePad"
    
  7. Use the dir command to view the installed files.

    dir
    
    Dd861741.note(en-us,VS.85).gifNote:
    Note that this copy of Notepad.exe will not actually run in this new directory due to missing dependencies in the Windows directory.

  8. Use the Control Panel to uninstall the MyNotepad application.

This is the last topic in this tutorial section. However, there are two other related tutorial sections that provide additional guidance. For more information about how to use Microsoft code name “Quadrant” with the SetupApplication model, see Using Quadrant with the SetupApplication Model. For more information about how to add SQL Server Modeling Services patterns to the SetupApplication model, see Adding Modeling Services Patterns to the SetupApplication Model.

See Also


Community Additions

Show:
© 2014 Microsoft