My adventure creating a Media Center add-in, part 3
I'm going to shift course a little bit from my previous entry regarding creating a Media Center add-in. For one thing, I still haven't had enough time to sit down and really dig into the code of the example add-ins that are installed as part of the Media Center SDK. For another, I have had a couple of folks ask me more in-depth technical questions about how to install an add-in and what exactly comprises the payload of an add-in setup package. So I set out tonight trying to figure out the deployment part of creating a Media Center add-in.
Based on my previous research, I knew that the contents of an add-in are basically a .NET assembly, an XML registration file that you pass into the application RegisterMCEApp.exe that ships in the %windir%\ehome directory as part of Media Center 2005, and any additional files (like bitmaps or data files) that the add-in might require. I had previously looked at an add-in written by Ethan Zoller, and the "setup" for his add-in was a simple batch file that copied the assembly to %windir%\ehome, called RegisterMCEApp.exe, and xcopied a few other files it needed to %windir%\ehome or a subdirectory.
This seemed straightforward enough, but being the setup geek that I am, I'm not a big fan of installations that use batch files and don't give the user a clearly defined, robust uninstall and transactional installation process. So I sought out better recommendations in the SDK documentation for creating a real setup package for installing and uninstalling add-ins. I found this page with a few links that describe how to perform various deployment related tasks:
- How to install an add-in assembly to the GAC - there is an interesting bit of info here that states that Media Center will only load add-ins that are installed on the local computer (as opposed to somewhere on the network), and the add-in has to reside in the GAC or in %windir%\ehome.
- How to register an add-in with Media Center
- How to create a simple MSI for an add-in using the Visual Studio setup/deployment wizard project
There is not really any other information in MSDN about deploying Media Center add-ins that I could find, but I suppose this is not too surprising considering that the installation process itself is fairly simple. Unfortunately, these docs assume the average add-in writer has a copy of Visual Studio .NET 2002 or 2003 and a good working knowledge of the Visual Studio setup/deployment project type. The good news is that the SDK ships a custom action DLL that can be consumed to run code that is the equivalent of RegisterMCEApp.exe during an MSI-based add-in setup process. I wonder why this registration has to be done with a black-box executable instead of just by creating some registry keys that Media Center knows how to read. I know I said when I started this add-in project that I was going to approach it as someone who did not have access to all of the Microsoft internal employee resources, so I will have to answer that question for myself with some side research some other time.
OK this is all I have time for tonight. I know this didn't really advance my ultimate goal of creating an add-in, but this research did fill in some background knowledge I'm going to need down the road, and it started me thinking about whether or not there are any ways to make the deployment of add-ins easier for customers.
Next time I'll look into some of the sample add-in code, I promise...
[to be continued]