Damian Mehers' Blog Android, VR and Wearables from Geneva, Switzerland.

9Mar/084

Referencing external assemblies using MCML

MCML is Windows Media Center Markup Language.  You use it to define the GUI for your Windows Media Center applications.

I've been banging my head against the wall trying to get a reference to a .NET assembly to work in MCML.  The example in the documentation uses the syntax:

xmlns:cor="assembly://MSCorLib/System"

Where MSCorLib is the name of the assembly in the Global Assembly Cache.

This worked fine for me where the assembly contained the current Media Center Application:

xmlns:ext="assembly://MceAppAssembly/SomeNamespace"

However when I wanted to reference a different external assembly (that was also in the GAC) I was getting an error loading the MCML page, indicating that the assembly could not be loaded.

In the end I found out that I needed to use a strong assembly name:

xmlns:ext="assembly://ExternalAssembly, Version=1.0.0.0, Culture=neutral,
  PublicKeyToken=0123456789abcdef/SomeNamespace"

I guess this is pretty obvious, but I'm also guessing that I won't be the only one to waste an hour or so on this.  The documentation doesn't give an example like this (just the weak named reference), although it does give strong named examples for resource references.

Comments (4) Trackbacks (0)
  1. What about a class library from the same solution. I too am scratching my head.

  2. i got the class library to work via the tokencode method above, however i can’t get a local file to work. just get Error 14 Unable to find type ‘ChannelList’.

  3. I had this problem too with local assemblies… if you are walking through the sample and you have installed your media center app then assembly://MceAppAssembly/SomeNamespace will actually pull the assembly MceAppAssembly from the GAC.

    If you have just added your custom class to SomeNamespace then it isn’t going to be in the assembly that the GAC knows about.

    The solution is to run DevInstall /u if you are using that command from the WMC SDK. If not the command is:

    %ProgramFiles%\Microsoft SDKs\Windows\v6.0A\bin\gacutil.exe /if “pathtoyourregisteredassembly”

  4. oh i am so happy i found these posts… both what Jon and damien have said have solved my last few hours trying to work out why i kept getting an error saying cannot find type… THANKS GUYS ! 🙂


Leave a comment

No trackbacks yet.