Showing posts with label GAC. Show all posts
Showing posts with label GAC. Show all posts

Tuesday, July 14, 2009

Where is gacutil for .NET 2.0

If you are trying to install a .NET 2.0 assembly to a client, you will notice that although the framework is installed, gacutil is missing.

So, you can copy gacutil from here, and you can send it with your assembly to client:
C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\

Adding new assembly to SharePoint

There are two ways to use your assembly in SharePoint:
1. Copy it to bin folder.
2. Move assembly into GAC.

If you put it in your bin folder, you will have partial trust, and your component cannot access to system resources such as registry. If you want to have full access then sign the component and add it to GAC.

After you add it to GAC, you have to add 2 entries to web.config:
1. To safe controls:
<safecontrol assembly="Baris.Security.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=20408sdf323sf" safe="True" typename="*" namespace="Baris.Security.Common">

2. To compilation:
<add assembly="Baris.Security.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=20408sdf323sf">

Monday, July 13, 2009

Re-sign assemblies if you don't have the source code

So, you have a third party assembly, and want to put it into GAC. (Or maybe into SharePoint, you have just figured that the "bin" folder does not allow your assemblies full trust to resources like registry).

Here are the steps:
1> ildasm /all /out=MyAsm.il MyAsm.dll
2> ilasm /dll /key=Companykey.snk MyAsm.il

Friday, January 20, 2006

HowTo: Install new assembly into GAC with key

I made a search on web, and this subject is not clearly defined in anywhere. Here is my blog on it:

1) prepare a key once:> sn.exe -k companyKeyPair.snk

2) on each client:> sn.exe -i companyKeyPair.snk

3) add your key to assemby (CompanyKey)
AssemblyInfo.cs: AssemblyKeyName("CompanyKey")]

4) add your assembly into GAC:> gacutil /i MyObject.dll

5) Now, to make your life easier, know that Visual Studio.NET doesn't check the GAC when you add references to projects. It checks a registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\AssemblyFolders

If you add a key below that key with a default value (string) of the path of where your assemblies are located, the next run of VS.NET will check that folder and your assemblies will show up in the dialog of the .NET references.