Partilhar via


RegisterMceApp.exe is not setup-friendly

I have been exploring creating MSI packages to install Media Center add-ins as part of my ongoing project to create my own Media Center add-in. During this process, I have discovered a couple of interesting behaviors of the RegisterMceApp.exe tool that we provide for add-ins to register themselves with Media Center:

  1. If you try to register an add-in that is already registered, RegisterMceApp.exe throws an exception and returns a non-zero value
  2. If you try to unregister an add-in that is already unregistered, RegisterMceApp.exe throws an exception and returns a non-zero value

These 2 facts make it somewhat complicated to launch RegisterMceApp.exe as a custom action to register an add-in using an MSI-based setup package. I talked to the developer who worked on this EXE and he provided the following suggestions that do not appear to be documented in the Media Center SDK currently:

  1. An MSI that calls RegisterMceApp.exe as a custom action should first call it in unregistration mode. This will ensure that any currently registered version of the add-in is removed. The custom action should be flagged to ignore the return code in case the add-in is not currently registered so that a failure to unregister will not cause setup to rollback
  2. An MSI should call RegisterMceApp.exe in registration mode during install and repair/reinstall, and it should obey the return code. However, it should make sure to call unregister first to avoid the exception that can be thrown if a previously registered add-in is registered again.

I realize that all of the above is fairly complicated. I am working on an example MSI package using WiX to demonstrate how to create a well-behaving Media Center add-in. Hopefully this example will demonstrate all of these concepts in a clearer way. I hope to have this example published soon (in the next week or so....)

Comments