What I've learned today - How to add library (dll) into the GAC using PowerShell and gacutil.exe
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
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
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
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