I know it has been a very long time since my previous post in this series, and I apologize for that. I have been pretty busy getting Update Rollup 2 ready and then working through some of the issues seen by customers after we released it. At any rate, I was sitting at the car dealership yesterday afternoon waiting for an oil change and tire rotation and decided to pick back up my effort to create a Media Center add-in.
The first thing I realized that I should do is check out the updated version of the Media Center SDK because we shipped an updated version at the same time that we released Update Rollup 2. So I started out by visiting the download site for the SDK and tried to download and install it. Since I already had the previous version of the SDK installed, I received a Windows Installer error dialog stating that another version of this product was already installed on the system. So I went and dug through my Add/Remove Programs control panel and uninstalled the version of the SDK that I had installed, then went back to the download site and this time it installed fine.
I decided I wanted to try to look at the code and try to build one of the sample add-ins to get a feel for what this process looks like to the average add-in developer, and also because I wanted to see what the default add-in MSI would look like after using Visual Studio to build the MSI. I decided to start with the screen saver sample (located in C:\Program Files\Microsoft\Microsoft Windows XP Media Center SDK\Sample AddIns\ScreenSaver if you install the SDK to the default location). I found the ScreenSaver.sln file and double-clicked on it to launch it in Visual Studio. I happened to have Visual Studio 2005 installed on my laptop, so I was prompted to convert the project files to the new format and stepped through the wizard to complete that task.
I glanced briefly through the code in Connect.cs and it made reasonable sense from a conceptual perspective. So I decided to try to build the project by pressing Ctrl + Shift + B in the VS IDE. When I did that, it ran for a while and then gave me some error messages about unresolved references. As it turns out, there is a reference to the Microsoft.MediaCenter assembly in the References node in the VS Solution Explorer, and it had a yellow exclamation point next to it on my machine, which indicates that the file couldn not be found in the expected location on my system. It was expecting to find Microsoft.MediaCenter installed to the GAC, but since my laptop is running Windows XP Pro and not Media Center, that file didn't exist anywhere on my system.
This presented an interesting dilemma to me - how do I get Microsoft.MediaCenter onto my development machine so that it will be recognized and allow me to successfully build this screen saver sample? I had been planning to use a remote development strategy for creating an add-in (create it on a development machine, deploy it to a MCE machine to test it out, iterate as needed). I definitely wasn't planning on using my Media Center machine as both the development machine and the test machine - it is configured on my TV in my living room, is set to 1600x900 resolution so the standard Windows desktop is barely readable without squinting and getting eye strain, and it doesn't even have Visual Studio installed anyways. Plus, at the time I tried to build this project, I was sitting in a car dealership and didn't have access to a copy of Microsoft.MediaCenter.dll to work around this issue. I dug through the MCE SDK documentation for a little while but couldn't find any mention of specific steps to take to build the sample add-ins correctly. So I temporarily gave up on fixing the build until I got home.
Once I got home I found a copy of Microsoft.MediaCenter.dll on my Media Center machine, copied it to the GAC on my laptop by using gacutil.exe (a tool that is installed as part of the .NET Framework SDK), and tried again to build the ScreenSaver add-in. This time it worked fine for me - the assembly reference no longer appeared with a yellow exclamation point and the project built correctly.
This is about all I had the energy to try last night, so I'm going to end this post here. Next time, I'm planning on looking at the contents of the MSI that was created for the add-in and see if I can figure out a way to simplify the 26 step process in the SDK document entitled Creating a Windows Installer File for an Add-in.
[to be continued]