The Media Center Sandbox

Resources and discussion for developing experiences in the Windows Media Center platform.
Welcome to The Media Center Sandbox Sign in | Join | Help
in Search

File Location for Addins?

Last post 11-26-2006, 2:56 PM by Iolaus. 16 replies.
Page 1 of 2 (17 items)   1 2 Next >
Sort Posts: Previous Next
  •  08-01-2006, 12:50 PM 293

    File Location for Addins?

    Is there a way to reference another directory location for addin dlls to be referenced? For example if I stored my files in “c:\program files\My Company\App Dir\” is there a way to setup the xml reg file to register my addin dll from there instead of copying it to the ehome directory?

     

    Thanks,

    R. Sparrow

  •  08-01-2006, 2:03 PM 294 in reply to 293

    Re: File Location for Addins?

    AFAIK, dll of an AddIn must be in GAC. It's not in the ehome directory.
  •  08-01-2006, 9:10 PM 297 in reply to 294

    Re: File Location for Addins?

    You want to install these into the GAC. Aaron and I have been working on install / uninstall scripts for use during development which can be run from the command line (with admin privileges) to (a) install the assembly into the GAC and (b) register the app with Windows Media Center. These assume you are in the same root Visual Studio solution folder and you have the GACUTIL tool installed (available from a variety of places, not the least of which is the .NET Framework SDK).

    Install.bat

    -----------------------

    REM Usage: Install.bat [Debug|Release] [NameOfDllWithoutExtension]

    @ECHO OFF

    if %1 == "" goto exit
    if %2 == "" goto exit

    if "%PROCESSOR_ARCHITECTURE%"=="x86" if "%PROCESSOR_ARCHITEW6432%"=="" goto x86

    :x64
    "%ProgramFiles(x86)%\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe" /i bin\%1\%2.dll
    goto register

    :x86
    "%programfiles%\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe" /i bin\%1\%2.dll
    goto register

    :register
    %windir%\ehome\RegisterMCEApp.exe Register.xml /allusers

    :exit

    Uninstall.bat

    -----------------------

    REM Usage: uninstall.bat [NameOfDllWithoutExtension]

    @ECHO OFF

    if %1 == "" goto exit

    %windir%\ehome\RegisterMCEApp.exe Register.xml /u /allusers

    if "%PROCESSOR_ARCHITECTURE%" == "x86" if "%PROCESSOR_ARCHITEW6432%" == "" goto x86

    :x64
    "%ProgramFiles(x86)%\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe" /u %1
    goto exit

    :x86
    "%programfiles%\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe" /u %1
    goto exit

    :exit

    -----------------------

    Technically speaking, you can copy into the %windir%\ehome folder and run from there without installing to the GAC. We don't recommend this approach for several reasons, some of which are...

    • This folder is a Microsoft folder and there is no telling what we (might) do to files contained therein -- you might get squashed at some point inadvertently -- I'm not sure of the System File Protection policies on this folder, but you don't want to risk it with your app.
    • It's common practice to place your experience in a unique location distinguishable from all others using %programfiles%\[Company]\[Application]\.

    Note you can't redist GACUTIL -- Windows Installer technologies can take care of registering your components in the GAC, so you don't need to redist. Aaron (a swami guru when it comes to setup) is working on some things for the SDK to help you get an installer working properly.


    Charlie Owen (Microsoft)
  •  08-01-2006, 9:15 PM 298 in reply to 297

    Re: File Location for Addins?

    I'll post the source via the blog for a super simple dialog box example this evening illustrating this approach too.


    Charlie Owen (Microsoft)
  •  08-01-2006, 11:33 PM 299 in reply to 298

    Re: File Location for Addins?

    Posted source including the above scripts to http://blog.mediacentersandbox.com/PermaLink,guid,ebdb55b3-12ff-4b75-aa23-005492c73763.aspx.
    Charlie Owen (Microsoft)
  •  08-02-2006, 2:29 AM 302 in reply to 299

    Re: File Location for Addins?

    To make life even easier, you can attach the uninstall script to the pre-build event, and the install script to the post build event.  This way you don't even have to do anything other than compile the app and then run it within Media Center.

    Cheers,
    Andy

  •  08-02-2006, 9:12 AM 311 in reply to 302

    Re: File Location for Addins?

    Nice. :-)


    Charlie Owen (Microsoft)
  •  08-02-2006, 10:37 AM 312 in reply to 311

    Re: File Location for Addins?

    Thank you very much. We'll try it out.

    R. Sparrow

  •  08-03-2006, 11:16 AM 325 in reply to 312

    Re: File Location for Addins?

    We are using Vista 5472 right now and we are installing about 6 dll to the GAC within the install process then use a two different app.xml file to register two different MCE addins. (One is a Background Addin and the other is an MCML addin.) The two addins reference the 4 other dlls in the GAC. Of course everything is signed and strong named. The install of the dlls to the GAC and the registration of the addins all come back as successful. However, when we go to try and run the application with the from MCE the dlls for those addins cannot be found.

     

    I turned on fusion logging and it’s was not checking the GAC for the dll. Just the ehome directory. I added the addin dlls (the two ones referenced in the app.xmls) to the ehome directory and everything worked. Am I missing something here or is there a bug in 5472 with loading addins from the GAC?

     

    R. Sparrow

  •  08-03-2006, 5:36 PM 330 in reply to 325

    Re: File Location for Addins?

    There is not a general bug that I know of regarding loading add-ins from the GAC in build 5472.5.  For example, the Media Center SDK installs McmlSampler.dll to the GAC and it runs fine from there within Windows Media Center.

    What I have seen in the past when I got this type of error was that the assembly identity I specified in the RegisterMceApp XML file was not correct or did not contain all of the attributes needed to fully identify the assembly in the GAC.

    Can you check and make sure that your AddIn tag in your RegisterMceApp XML file looks something like the following (this is what we have for McmlSampler):

    "Microsoft.MediaCenter.Samples.McmlSampler, McmlSampler,Culture=Neutral,Version=6.0.6000.0,PublicKeyToken=31bf3856ad364e35"

    Specifically, you need to make sure that the assembly identity you provide includes assembly name, culture, version and public key token and that all 4 are correct.

    Hopefully this helps.

    Thanks!  Aaron

     

  •  08-06-2006, 1:08 PM 342 in reply to 330

    Re: File Location for Addins?

    Got ya. I was missing those settings (Culture, Version, and PublicKey) it wasn't in the example I had. Thanks I think that will do it.

    R. Sparrow

  •  08-29-2006, 11:50 AM 437 in reply to 342

    Re: File Location for Addins?

    I am also missing the same settings (Culture, Version, and PublicKey) Culture, and version are not a problem as I can edit my project for them to work, however, how do I generate a PublicKey?
    blog.manghera.com
  •  08-29-2006, 1:01 PM 438 in reply to 437

    Re: File Location for Addins?

    I found out how to get the public key tokens, cultures, version, etc... for my addin. My addin references two other dll's in addition, for these other two I simply went to the .NET 2.0 Assembly Cache and manually added these two DLL's

    When I run the install.bat utility it returns with "Success"

    So I then move on and run media center, sure enough my application is there in more programs. I open my application the screen changes, at this point I believe it is loading, no error messages are being displayed, but nothing happens. I am stuck looking at Vista's MCE background I do not see my application at all. What have I missed?

    **EDIT**

    For testing purposes i used the install.bat script with the default MCML project (Bouncing smiley face and text), and it registers fine and I am able to view it in Media Center with no problems.

    I'm beginning to think there is a problem with the DLL references of my Application. When I test using MCMLPad it works, when I try registering my addin with the install.bat its a no-go.

    **EDIT 2 **

    I was able to resolve the issue, im not sure what exactly was wrong but I first cleaned out the GAC and the Registry and began this process one-by-one and it now works as expected.


    blog.manghera.com
  •  08-30-2006, 12:14 PM 440 in reply to 438

    Re: File Location for Addins?

    I still can't get MCE to load my app from the GAC. It just looks in \Windows\Ehome. All my DLLs are registered in the GAC and are signed. I turned Fusion on, and see MCE trying to load my Add-In DLl from \Windows\eHome.

    Do you really need a bat file to register in the GAC. Can't you just add:

    "$(DevEnvDir)..\..\v2.0\Bin\gacutil" /f /i  "$(TargetPath)"

    to the Post-build events? It is regitering fine, but can't run the Add-In.

    zakspeed

  •  09-30-2006, 5:58 AM 591 in reply to 440

    Re: File Location for Addins?

    zakspeed,

    You ever get a resolution for this?  I'm seeing the same thing on 5600.  I know my DLL is registered in the GAC, but when I use MCMLPad (via F5 in VS2005) it can only find the DLL if I copy it into the same folder as the starting DLL.   If I run from within MCE, it fails with a Microsoft.MediaCenter.UI.HostLoadException.

    Cheers,
    Andrew

Page 1 of 2 (17 items)   1 2 Next >
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems