This project template includes the files necessary to create a simple Windows Media Center Application using managed code and Media Center Markup Language (MCML). The template results in the minimum amount of code and markup to produce an application and is designed to be the foundation upon which a developer will build a richer application.
The following steps are unique to each application and must be performed before the application will run within Windows Media Center. After these steps are completed use the DevInstall.cmd script from a command prompt with administrator privileges to perform a development install of the application and launch from Program Library in Windows Media Center.
1. Select the project in the Solution Explorer pane.
2. Select View > Property Pages from the menu.
3. In the Properties window:
a. Select the Signing tab.
b. Check the box labeled Sign the assembly.
c. Click on the Choose a strong name key file drop-down list and select <New...>.
d. In the Create Strong Name Key dialog:
i. Enter a key file name
ii. Optionally provide a password for the key file.
iii. Click OK.
4. Select File > Save All from the menu.
5. Select Build > Build Solution from the menu to build the project assembly with the strong name key file.
1. Select Tools > External Tools from the menu.
2. In the External Tools dialog:
a. If there are already existing tools click Add to create a new one. Otherwise, if this is the first external tool [New Tool 1] is already selected
b. Enter Get Public Key in the Title text box.
c. Enter the following in the Command text box:
i. x86 users type the following: C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\sn.exe.
ii. x64 users type the following: C:\Program Files (x86)\Microsoft Visual Studio 8\SDK\v2.0\Bin\sn.exe.
d. Type the following in the Arguments text box: -Tp "$(TargetPath)"
e. Uncheck all options except Use Output window.
f. Click the OK button.
3. Select Tools > Get Public Key from the menu.
4. Copy the public key token value from the output window.
5. Open the Registration.xml file for editing with a double-click in the Solution Explorer pane.
6. Replace insert_public_key_token_here with the public key token reported by the Get Public Key tool.
7. Select File > Save All from the menu.
8. Select Build > Rebuild Solution from the menu.
Also included are the necessary files to create a Windows Installer Package (*.msi) based setup program using the Windows Installer XML (WiX) toolset. This feature of the application template is not enabled until the WiX toolset is installed and certain properties in the project modified as follows:
1. Download the latest version of the Windows Installer XML (WiX) toolset version 3.0 setup program (wix3.msi) from http://wix.sourceforge.net/releases/ and install it on the development computer.
2. Start Microsoft Visual Studio 2005 or Microsoft Visual C# 2005 Express Edition.
3. Open the Windows Media Center application already created, or create a new one using the Windows Media Center Application project template by selecting File > New Project from the menu.
1. Select the project in the Solution Explorer pane.
2. Select View > Property Pages from the menu.
3. In the Properties window:
a. Select the Build Events tab.
b. Add a new line to the Post-build event command line text box.
c. Type the following on the new line: "$(ProjectDir)Setup\Build.bat" $(ConfigurationName)
4. Select File > Save All from the menu.
5. Select Build > Rebuild Solution from the menu to build the project binaries and the Windows Installer Package.
A Windows Installer Package file named Setup.msi is created in the \bin\release or \bin\debug folder for the project depending on which configuration was built. The files in the \Setup folder for the project can be customized in order to change the behavior of the installer.
This project template contains the following post-build steps to aid markup development and debugging:
· The MCML Verifier Tool (McmlVerifier.exe) verifies the syntax of all MCML files in the \Markup folder for this project. Any errors are displayed in the output window -- double-click the error to open the file containing the error.
· The MCML Preview Tool (McmlPad.exe) runs in standalone mode and loads the file named test.mcml in the \Markup folder for this project.
Use the following instructions to make changes to the build events in the project template. Note some build events must be enabled by directly modifying the project file (*.csproj) outside of Visual C# 2005 Express Edition. For more information see the Windows Media Center Step By Step whitepaper included in the SDK.
Advanced build configurations must first be enabled in Visual C# 2005 Express Edition and Visual Basic 2005 Express Edition using the following steps:
1. Select Tools > Options from the menu.
2. In the Options dialog:
a. Check the box in the bottom left corner labeled Show all settings.
b. Select the Projects and Solutions item in the tree control.
c. Check the box labeled Show advanced build configurations.
d. Click OK.
1. Select the project in the Solution Explorer pane.
2. Select View > Property Pages from the menu.
3. In the Properties window:
a. Click on the Build Events tab.
b. Modify the values in the Pre-build event command line and Post-build event command line text boxes as needed.
c. Click on the Debug tab.
d. Modify the values in the Command line arguments and Working directory text boxes as needed.
4. Select File > Save All from the menu.
Use the following basic steps to add additional code, markup (MCML) and images to the project created by the template.
1. Select the Code folder in the Solution Explorer pane.
2. Select Project > Add New Item from the menu.
3. In the Add New Item dialog:
a. Select the Class, Interface or Code File template.
b. Enter the name for the file.
c. Click the Add button.
1. Select the Markup folder in the Solution Explorer pane.
2. Select Project > Add New Item from the menu.
3. In the Add New Item dialog:
a. Select the MCML File template.
b. Enter the name for the file.
c. Click the Add button.
4. Double-click Resources.resx in the Solution Explorer pane to open for editing.
5. Press CTRL+5 on the keyboard to switch to File resources.
6. Drag and drop the new MCML files from the Solution Explorer pane into the Resources.resx window.
1. Double-click Resources.resx in the Solution Explorer pane to open for editing.
2. Press CTRL+2 on the keyboard to switch to Image resources.
3. Drag and drop the image files from the Solution Explorer pane into the Resources.resx window.
4. Alternatively…
a. Select the Add Resource drop down list in the Resources.resx window.
b. Select Add Existing File.
c. In the Add existing file to resources dialog:
i. Browse to and select the files to be included.
ii. Click the Open button.