[Mono-list] How do i tell Mono (for ASP.NET, C#) where to find MySQL.Data.MySqlClient
Peter Bradley
P.Bradley at dsl.pipex.com
Mon Oct 23 14:17:06 EDT 2006
Ysgrifennodd Dick Steflik:
> Peter,
> Thanks for butting in; answering your questions:
> First: I think the GAC is kinda like the Windows registry in that it
> allows me to make use of Windows dynamic link libraries that haven't
> been written to us windows specific APIs
Well, not really. The GAC is a physical file locations holding physical
directories and physical files. Assemblies are stored in the GAC, an
operation that you carry out using the gacutil tool.
> Second: Focusing only on ASP.NET it searches for a referenced assembly
> in web.config then in the application /bin director or vice versa; or
> is there somthing else happening?.
Again, not really. If I understand things correctly, when the runtime
searches for a referenced assembly it first looks in the GAC and then in
the same directory as the assembly it's executing. The Web.config entry
simply tells it the name of the assembly it needs to look for. I may be
less than 100% accurate on this; but someone will correct me if I'm wrong.
> Third: this is pretty vague to me
Giving an assembly a strong name means blessing it with a public and
private key. You use the tool called sn.exe to do this. If you do sn
-h sn, you get this output:
peter at linux:~> sn -h sn
Mono StrongName - version 1.1.8.0
StrongName utility for signing assemblies
Copyright 2002, 2003 Motus Technologies. Copyright 2004-2005 Novell. BSD
licensed.
Usage: sn [-q | -quiet] options [parameters]
-q | -quiet Quiet mode (minimal display)
StrongName signing options
-D assembly1 assembly2
Compare assembly1 and assembly2 (without signatures)
-k keypair.snk
Create a new keypair in the specified file
-R assembly keypair.snk
Resign the assembly with the specified StrongName key file
-Rc assembly container
Resign the assembly with the specified CSP container
-t file
Show the public key from the specified file
-tp file
Show the public key and pk token from the specified file
-T assembly
Show the public key from the specified assembly
-Tp assembly
Show the public key and pk token from the specified assembly
-v assembly
Verify the specified assembly signature
-vf assembly
Verify the specified assembly signature (even if disabled).
<1> Currently not implemented in the tool
peter at linux:~>
To give an assembly a strong name you first need to create your key pair
(sn -k <filename>). Keep your private key safe somewhere.
In your project, edit AssemblyInfo.cs. Give your version a fixed
version number (no * in it), and point to your keypair file (the one you
just created). Something like this:
|[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("C:\\myKeyPair.snk")]
[assembly: AssemblyKeyName("")]|
Now recompile. This will compile your assembly with a strong name. You
can't put anything in the GAC until it has a strong name.
Finally, use gacutil as outlined by Robert to put your assembly in the
GAC, and alter Web.config to look for the strongly named assembly.
> When I look in the GAC using gacutil I can see everything that has
> been registered but I don't see anything that says where the
> assemblies are physically located.
Are you on linux? On my SuSE box, the GAC is at /usr/lib/mono/gac.
Each assembly has a directory. Under that each version of the assembly
has a directory. The assemblies themselves along with any configuration
files are in these directories.
HTH. And I hope anyone more expert than me will correct any errors,
ambiguities or over-simplifications.
Cheers
Peter
More information about the Mono-list
mailing list