Results 1 to 6 of 6

Thread: .net 2.0 equivelant of fusioninstall.cs ?? (GAC)

  1. #1
    Theoretical Element Spud1's Avatar
    Join Date
    Jul 2003
    Location
    North West
    Posts
    7,508
    Thanks
    336
    Thanked
    320 times in 255 posts
    • Spud1's system
      • Motherboard:
      • Gigabyte Aorus Master
      • CPU:
      • 9900k
      • Memory:
      • 16GB GSkill Trident Z
      • Storage:
      • Lots.
      • Graphics card(s):
      • RTX3090
      • PSU:
      • 750w
      • Case:
      • BeQuiet Dark Base Pro rev.2
      • Operating System:
      • Windows 10
      • Monitor(s):
      • Asus PG35VQ
      • Internet:
      • 910/100mb Fibre

    .net 2.0 equivelant of fusioninstall.cs ?? (GAC)

    Just a quick question, that could save me hours of time

    I'm playing around with .NET shell extensions again, and I have an extension that works perfectly, picking up calls to ShellExecuteEx.

    My problem is, that to make this work, as well as registering my extension through com (which is easy), I also need to import it into the GAC of the host machine.

    Now this is easy to do manually - just drag and drop the dll, or use the tools included with the SDK, however I want to be able to do this programatically, so that running the exe I provide with my solution will register the dll with com AND GAC, and also be able to unregister it when a /u switch is there.

    With .NET 1.0 and 1.1 you could do this using a file called fusioninstall.cs which was included with the SDK. This provided some functions which you could just wrap with a .NET class and call to import/remove the dll from the GAC at runtime. However I cannot get this to work with .NET 2.0 at all - it will compile fine using the fusioninstall.cs file from .NET 1.1, however at runtime it gives me a “System.EntryPointNotFoundException” Exception.

    I *think* that this is because the entrypoints for the required functions in fusion.dll have changed with .NET 2.0 (since the CLR team *loves* to break things between revisions, and they hate to document important things like fusion.dll), so i'm looking for another way to do it

    Anyone got any ideas? Maybe it has been incredibly simplified in 2.0 and I just can't find the right classes to use..or it could even be a simple modification to the fusioninstall.cs file..i'm still playing around with it to see if I can get it working, but maybe someone here has some ideas

    Thanks in advance,

    Spud/Pete

  2. #2
    Seething Cauldron of Hatred TheAnimus's Avatar
    Join Date
    Aug 2005
    Posts
    17,168
    Thanks
    803
    Thanked
    2,152 times in 1,408 posts
    do you really need to GAC it?

    while there are some advantages, if the dll is only for COM interop, it might be better not too.

    regasm /CODEBASE is the cry!

    (you can also configure this behaviour in the installer wizard).
    throw new ArgumentException (String, String, Exception)

  3. #3
    Theoretical Element Spud1's Avatar
    Join Date
    Jul 2003
    Location
    North West
    Posts
    7,508
    Thanks
    336
    Thanked
    320 times in 255 posts
    • Spud1's system
      • Motherboard:
      • Gigabyte Aorus Master
      • CPU:
      • 9900k
      • Memory:
      • 16GB GSkill Trident Z
      • Storage:
      • Lots.
      • Graphics card(s):
      • RTX3090
      • PSU:
      • 750w
      • Case:
      • BeQuiet Dark Base Pro rev.2
      • Operating System:
      • Windows 10
      • Monitor(s):
      • Asus PG35VQ
      • Internet:
      • 910/100mb Fibre
    Yeah unfortunately I do - it's a shell/namespace extension that relys on a Windows Hook - so it has to sit in the GAC to work properly.

    I can do it manually or with the windows installer..it would just be nice to have a programatic way to do it as we could previously (fusioninstall was undocumented anyway so likely to vanish at any time, but still).

  4. #4
    Seething Cauldron of Hatred TheAnimus's Avatar
    Join Date
    Aug 2005
    Posts
    17,168
    Thanks
    803
    Thanked
    2,152 times in 1,408 posts
    seriosully do you really need to GAC it?

    is it a common DLL going to be used by other devleopers.

    If its only been used via COM, there is no need to GAC it.

    a standard regasm produces the clasid and typelib for the assembly. If the assembly is located within the basepath of the .net appdomain its been loaded into (ie if there is already a .net COM interop going on) then it willl search that path. As such it will only seam to work if you put it in the gac.

    if you register it with the /CODEBASE command, it looks for it in the place you register it (ie PRogram Files\Super cool shell extension).

    some general good advise that took me a while to scrounge together:

    MsCoree creates a shim around the managed code. As such the managed code can live anywhere.

    A couple of things to watch out for in this, is that you can only have one version of the runtime per proccess. Meaning that if someone has loaded a .net 1.0 app into explorer already, you can't load yours. As such yours will just appear not too work, with no real explentation.

    Custom shimming is the best way to determine when this is happening (as well as added security). As long as you don't need automation support, this is trivial.

    Another 'top tip' is too use the Policy registry keys, or an Explorer.exe.config with a supported runtime attribute in it.
    throw new ArgumentException (String, String, Exception)

  5. #5
    Theoretical Element Spud1's Avatar
    Join Date
    Jul 2003
    Location
    North West
    Posts
    7,508
    Thanks
    336
    Thanked
    320 times in 255 posts
    • Spud1's system
      • Motherboard:
      • Gigabyte Aorus Master
      • CPU:
      • 9900k
      • Memory:
      • 16GB GSkill Trident Z
      • Storage:
      • Lots.
      • Graphics card(s):
      • RTX3090
      • PSU:
      • 750w
      • Case:
      • BeQuiet Dark Base Pro rev.2
      • Operating System:
      • Windows 10
      • Monitor(s):
      • Asus PG35VQ
      • Internet:
      • 910/100mb Fibre
    The way I have been doing it is to add an entry under HKCR\clsid and then set the InProcServer32 entry mscoree.dll to allow the CLR to intercept COM instantiations. The CLR can then use the progid key to find the .NET assembly and instantiate the class.

    Will have a look at using /CODEBASE though, thanks for the suggestion..won't know if it works until I try

  6. #6
    Seething Cauldron of Hatred TheAnimus's Avatar
    Join Date
    Aug 2005
    Posts
    17,168
    Thanks
    803
    Thanked
    2,152 times in 1,408 posts
    regasm /CODEBASE

    for the win... init.

    COM interop gets complicated when your providing plugins, as with .net you can only have one version per proccess. This means that if someone has already loaded .net 1.0... Your screwed. Your code won't even get run, no error message will be displayed, you will not pass go, you will not collect £200.

    A native code 'Shim' is the solution too this. I've got some examples for extending office, but not explorer (thou the principle is the same).
    throw new ArgumentException (String, String, Exception)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. USB 2.0 Question
    By Lexeus in forum PC Hardware and Components
    Replies: 3
    Last Post: 10-12-2003, 07:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •