August 20, 2006

Media Center Hosted HTML Application Setup Project for Windows Vista

Filed under: Uncategorized — Anthony Park @ 5:42 pm

Recently, I’ve received quite a few requests to release a version of MCEBrowser that will install on Windows Vista. The current installation package fails when run on Windows Vista with the error “This AddIn can only be installed on Windows XP Media Center Edition 2005 or later.” Upon further investigation, I found that this error was being caused by the registration process, which uses the RegisterAddIn dll from the Media Center 2005 SDK.

The new Windows Vista Media Center SDK does not come with this dll, and I am unsure if it ever will. So… I decided to remove the dependency on the SDK dll and register MCEBrowser in the setup project by writing the appropriate registry keys. Here’s how I did it using Visual Studio 2003:

Step 1: Create a new setup project.


- Select “File | New | Project…” from the menu.





- Select the “Setup and Deployment Projects” folder, and select “Setup Project”.
- Type in the Name and the Location of the Setup project.

Step 2: Setup Project Settings


- In the Solution Explorer, select the Setup project.
- In the properties window, fill in the relevant project properties. In my case, I filled in Author, Manufacturer, ProductName, Title, and Version.





Step 3: Add Files


- Click on the “File System Editor” toolbar button in the Solution Explorer to open the File System Editor.
- Add any folders and files that you would like to install in the Program Files folder on the machine.





Step 4: Add Media Center Launch Condition


One of the requirements of any good setup project is that it will prevent the user from installing on a non-supported operating system. We can accomplish this task by using a launch condition.

- In the Solution Explorer, click the “Launch Conditions Editor” toolbar button to open the Launch Conditions Editor.

- Right-click on the “Search Target Machine” folder and select “Add Registry Search”.
- Name the new item something meaningful, like “Windows Media Center Required”.
- In the properties window, set the Property, RegKey, Root, and Value properties. According to Aaron Stebner, this is the correct way to check for the existence of Media Center in a setup project.





- Right-click on the “Launch Conditions” folder, and select “Add Launch Condition”.
- Name the new item something meaningful, like “Windows Media Center Required”.
- In the properties window, set the Condition, and Message properties. An Ident of “3.0″ is for Media Center 2005.







Step 5: Register your Application with Media Center


This is the part where we used to be able to use the RegisterAddIn.dll to make our lives really easy!

Okay, before we can complete this step, we need to generate two guids for our application. Luckily, Visual Studio has a “Create GUID” tool that will do the job.

- Select Tools | Create GUID from the Visual Studio menu.
- Select the “Registry Format” in the tool, and copy your new guid to the clipboard using the Copy button.




Okay, I said we needed two guids, right? The SDK recommends that you use sequential GUIDs to register your application to make troubleshooting and locating them in the registry easier. We’ll call our two GUIDs the “Application GUID” and the “Entry Point GUID”.

- Application GUID: {B872E129-55C0-4dfc-8A14-E7DEFB873A14}
- Entry Point GUID: {B872E129-55C0-4dfc-8A14-E7DEFB873A15}

Now that we have our two GUIDs, we’re ready to create the registry keys we need…

- In the Solution Explorer, click the “Registry Editor” toolbar button to open the Registry Editor.
- Right-click on the “User/Machine Hive” folder in the Registry Editor and select “New Key”. Create a structure that looks like this:




Notice how we use our “Application GUID” under the “Applications” key, and our “Entry Point GUID” under the “More Programs” and “Entry Points” keys?

- On each of the GUID keys, change the “DeleteAtUninstall” property to true. This will unregister the application when it is uninstalled.

- Under the Applications\[GUID] folder, create two string values called “CompanyName” and “Title”.




- Under the Categories\More Programs\[GUID] folder, create a string value called “AppId” and a DWORD value called “TimeStamp”. Put the Application GUID in the Value property of the AppId, and put your favorite timestamp in the Value property of the TimeStamp.




- Under the Entry Points\[GUID] folder, create string values called “AppId”, “Description”, “ImageURL”, “Title”, “URL”, and a DWORD value called “TimeStamp”.

- Put the Application GUID in the Value property of the AppId, and put your favorite timestamp in the Value property of the TimeStamp. The ImageURL value should point to the picture you want to display in the “More Programs” screen in Media Center. The URL value should point to the page that you want Media Center to start when your AddIn is launched by the user.




Step 6: Install and Enjoy your Hosted HTML Application!

1 Comment

  1. Can’t get this working.

    Got the same problem, since the registerapp.dll is gone in the sdk.
    Tried upper solution, for a background addin.

    The keys in the registry were made, but the addin doesn’t start.
    … and is not listed in the settings menu.

    When passing the registerapp.xml to the registerapp.dll there were more information:

    What about the publickeytoken, the culture, the version.
    How to move the dll to the gac?

    Mic

    Comment by Mic — April 15, 2007 @ 3:23 am

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.