First of, you have to have a library that you want to add to GAC. In my case it will be a Microsoft.Smartdevice.Connectivity.dll, which, version 10.0.0.0, you can find on google code.

Secondly, you need to have PowerShell installed on your machine. If you don’t have it, it’s a part of the Windows Management Framework and can be installed from there.

Having those prepared we can start installation process. Run PowerShell as administrator

running_powershell_as_administrator

After having PowerShell window in front of you, we will set alias to gacutil.exe so we could use this executable with a simple alias. What you have to do i is to type Set-Alias command in the PowerShell command and press return (hit enter). You will be asked to specify Name of our alias and Value you want to correlate with this name. The code itself will look like so

Set_Alias_in_powershell_for_gacutil

Bear in mind your Windows version, for me it’s Windows 8.1, hence the path is v8.1A. You can go to the directory

C:\Program Files (x86)\Microsoft SDKs\Windows

and chose the folder with the version of your Windows. After having this done, we can proceed to the installation with our just created alias. It’s done by just one line of code, which is

gacutil /i “<your_path_to_the_dll_file_you_want_to_install_in_GAC>\Microsoft.Smartdevice.Connectivity.dl”

Remember to put the path in between quotes e.g. “<path>”, because if there are spaces in the path, it will be misinterpreted by the gacutil and installation will fail. For me it looked like so

library_successfully_added_to_gac

In the end you can check if your library is truly in the GAC by going to the path

%windir%\Microsoft.NET\assembly

mine was installed in here

library_installed_in_gac

  1. Ahmed Reply

    Thanks man it helps !

  2. Nico Reply

    Hello,
    Can you help with this problem :
    I did as you said but the problems is that I don’t succeded to this step :
    gacutil /i
    “\Microsoft.Smartdevice.Connectivity.dl”
    Remember to put the path in between quotes e.g. “”, because if there are spaces in the path, it will be misinterpreted by the gacutil and installation will fail. For me it looked like so

    library_successfully_added_to_gac

    • Mikołaj Reply

      Hi Nico,

      Could you provide more information about what’s happening ?

      Are you succeeding with setting the alias (Set-Alias) ? What path to gacutil.exe do you set as a Value of the alias ?

      Could you provide a Error message that you’re getting ?

      Mikolaj

  3. Vinayak Reply

    gacutil /i “\Microsoft.Smartdevice.Connectivity.dl”

    Which path will be here
    1. Any path
    2. C:\Windows\Microsoft.NET\assembly\GAC_MSIL

Leave a Reply

*

captcha *