none
Registration of .Net Dll/Assemblies & Gacutils dependency on Installed .Net Framework in client System. RRS feed

  • Question

  • Hi All,
     
    In my current .Net Application, I need to resolve/clarify few aspects, on .Net Dll's
     
    1) Is .Net Dll's needs to be registered ? If yes, under what circumstances, and how would one effect the registration part of the .Net Dll.
     
     for eg: using Regsvr32.exe "path name/xyzcomInproc.dll" @ command prompt.,
     
    similarly, I need to know the steps w.r.t register the .NetDll & context when it could be applicable.
     
    2)Also, I require few clarification on usage of GACUtils.exe tool does this tool depend on the Version of .Net Framework installed to extract the modules.

    i) .Net Framework 1.1v, 2.0v, 2.5v, 3.0v ,3.5v the location of GACUtils (C:\Windows\Assemblies)
     
    ii) for .Net Framework 4.0 v and above - the location is C:\WindowsNT\Microsoft.Net\Assemblies).
     
    Using .Net Reflector tool(Third party tool), I was able to narrow down on dll's belonging to .Net Assemblies., from about 600 dll's in my Project,
     
    Please find some findings relevant to COM Dll's(InProcServer),

    ie., All project related .Net Dll's /binaries, need to be  registered , after subjecting few changes by adding new interfaces/methods,  how can one effect the same in .Net Project,

     

    eg: using DllRegisterServer() we identify and implement new interfaces/methods, (viz., Message box etc) and modification of interfaces/methods would lead to  Registry (HKCU/HKLM/....) changes involving registration of COM Dll(Regsvr32.exe)

    But, I need to overcome few obstacles, w.r.t Registration of .Net Dll's in particular and the Infrastructure of the system it is dependent.(like .Net FrameWork Version dependency has hightlighted above).

     

    Details:
     
    VS 2008 IDE, Windows 7 O/S,


    Any help in resolving the above issues would be much appreciable.

     Regards,
    VishaK_90


    Vishal_K89

    Thursday, March 28, 2013 12:32 PM

Answers

  • You only need to use regasm if you are registering a COM component that is implemented in .NET.  If your .NET code has no COM components then you don't need to register anything.  If you are using a COM component then you'll need to register the assembly based upon whether it is an x86 or x64 component (or both).  The Framework and Framework64 directories each contain the appropriate version of regasm.

    You can only GAC an assembly that is strongly named.  If your assembly is shared by multiple products then GACcing it makes sense.  Otherwise don't bother.  To GAC the assembly you run the command line tool.  You should use whatever the latest version is.  The .NET framework of the assembly isn't relevant because all GACced assemblies are stored in the same folder structure.  You cannot GAC different framework versions of the same assembly without also giving it a different version #.  For example you might have AssemblyA v1.0 which is built against CLR v2 GACced.  You can then GAC AssemblyA v2.0 which is built against CLR v4.  The dependent application determines what version to use based upon what version it was built against.  You could not however GAC AssemblyA v2.0 which is also built against CLR v2 because there is already a v2.0 version.

    Michael Taylor - 3/27/2013
    http://msmvps.com/blogs/p3net

    • Marked as answer by VishaK_90 Friday, March 29, 2013 7:54 AM
    Thursday, March 28, 2013 2:20 PM
    Moderator

All replies

  • You only need to use regasm if you are registering a COM component that is implemented in .NET.  If your .NET code has no COM components then you don't need to register anything.  If you are using a COM component then you'll need to register the assembly based upon whether it is an x86 or x64 component (or both).  The Framework and Framework64 directories each contain the appropriate version of regasm.

    You can only GAC an assembly that is strongly named.  If your assembly is shared by multiple products then GACcing it makes sense.  Otherwise don't bother.  To GAC the assembly you run the command line tool.  You should use whatever the latest version is.  The .NET framework of the assembly isn't relevant because all GACced assemblies are stored in the same folder structure.  You cannot GAC different framework versions of the same assembly without also giving it a different version #.  For example you might have AssemblyA v1.0 which is built against CLR v2 GACced.  You can then GAC AssemblyA v2.0 which is built against CLR v4.  The dependent application determines what version to use based upon what version it was built against.  You could not however GAC AssemblyA v2.0 which is also built against CLR v2 because there is already a v2.0 version.

    Michael Taylor - 3/27/2013
    http://msmvps.com/blogs/p3net

    • Marked as answer by VishaK_90 Friday, March 29, 2013 7:54 AM
    Thursday, March 28, 2013 2:20 PM
    Moderator
  • Thanks , The Information was very helpful.

    Vishal_K89

    Friday, March 29, 2013 7:56 AM