Global Assembly:
.NET allows us to store and use different versions of same assembly without any problems
means successfully overcome dll hell problem.
The default system folder where your gac reside at:
c:/windows/system32/assembly
you can use an utility form dos prompt to view / list of all assemblies
prompt > gacutil /l ==> /l for listing
to make any .dll file in this directory u can use the same utility
prompt > gacutil /i yourfile.dll ==> /i means install
The conditions to make your dll as available in gac:
1. Provide strong naming
2. Should have a unique version.
Steps to create a global assembly:
create a file test.cs
using System.Reflection;
[assembly:AssemblyKeyFile("app.snk")]
[assembly:AssemblyVersion("1.0.0.1")]
public class test
{
public static void t1()
{
System.Console.WriteLine("global assembly");
}
}
prompt > sn - k app.snk //way to create strong name key file
prompt > csc /t:module /out:bin\test.dll test.cs
prompt > al /t:libary /out:bin\ga.dll test.dll
prompt > gacutil /i ga.dll
Now at runtime any one can refer this dll for their application.
Tuesday, July 1, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment