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

Remote Desktop Port : 3389

The default port is> 3389
Registry location> HKEY_LOCAL_MACHINE\ System\CurrentControlSet\Control\TerminalServer\WinStations\RDP-Tcp
Connecting to machine with different port> computername:port

Thursday, July 09, 2009

IIS Error: Failed to access IIS metabase, "The process account used to run ASP.NET must have read access to the IIS metabase"

If you experience this error, probably you have installed IIS after .NET installation. So, what you need to do is to stop IIS and re-install ASP.NET for both 1.1 and 2.0.
Run the following command set (better create an x.cmd file and run that), and don't forget to change machinename to your computer's name:
iisreset -stop
cd\
cd %windir%Microsoft.NET\Framework\v2.0.50727
aspnet_regiis -ua
aspnet_regiis -i
aspnet_regiis -ga machinename\ASPNET
cd\
cd %windir%Microsoft.NET\Framework\v1.1.4322
aspnet_regiis -i
iisreset -start

And that is it :)