C#. Shared assembly

Lets use Carlib.dll from One file Assembly

1. Strong name

Properties – > Signing – > Sign the assembly -> New – > SomeName (for ex. myKeyPair.snk)

2.  Install assembly to GAC (Global Assembly Cache)

go to

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio 2015\Visual Studio Tools\Developer Command Prompt for VS2015

start Developer Command Prompt for VS2015 with Admin rights

write something like

C:\C#\MyC#StudyProjects\07_DifferentMains\CarLibrary\CarLibrary\bin\Debug>gacutil -i CarLibrary.dll

and receive

Сборка успешно добавлена в кэш

check if assembly in GAC

C:\C#\MyC#StudyProjects\07_DifferentMains\CarLibrary\CarLibrary\bin\Debug>gacutil -l CarLibrary

and receive

В глобальном кэше сборок содержатся следующие сборки:
CarLibrary, Version=, Culture=neutral, PublicKeyToken=6a9228aea5de13fa, processorArchitecture=MSIL

Число элементов = 1

3. Use  assembly

In MS Visual Studio – Class View – right click add Reference – > Browse

add assembly to solution… go to…


and add CarLib.dll

4. Use it in project – now assembly not copied to location of program


This entry was posted in C#. Bookmark the permalink.