.NET : .NET News
Updated: 7/1/2002; 9:31:14 PM.

 

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.

 
 

Wednesday, May 29, 2002

Programatically Determining if a PIA is in the GAC


One of today's many tasks was trying to determine if a Primary Interop Assembly (PIA) is already in the GAC.

I have an installer program that needs to know whether PIAs are already installed in the GAC so that I won't install them twice. So the question is how can we programmatically tell whether the GAC contains a particular assembly?

References:

I found these articles:

Assembly.Load Method (AssemblyName)

ms-help://MS.VSCC/MS.MSDNVS/cpref/html

/frlrfsystemreflectionassemblyclassloadtopic1.htm

Assembly.LoadWithPartialName

ms-help://MS.VSCC/MS.MSDNVS/cpref/html/

frlrfSystemReflectionAssemblyClassLoadWithPartialNameTopic.htm

How the Runtime Locates Assemblies ms-help://MS.VSCC/MS.MSDNVS/cpguide/html/

cpconhowruntimelocatesassemblies.htm

The third article says that if you want to load an assembly from the GAC as opposed to just from the app directory, you need to call Assembly.LoadWithPartialName rather than Assembly.Load.

This is the best answer I've found so far: try to load the assembly then if that fails, then the assembly isn't there. This is lame, however. We don't want to load the assembly, we just want to know whether it exists or not.

One answer is that because it is PIA, installing it to the GAC with the same name will simply over-write it.

Jason Bock crufted up some code for me that reads the assemblies in the GAC and does comparison.

But then I find this and it turns out Mattias has figured out how to use the undocumented Fusion APIs!!! He has a sample here.



10:18:56 PM    

A Whole Collection of .NET Tools and Samples


There are currently 501 User Samples of .NET code at GotDotNet of all sorts.

NZipLib:

NZipLib is a Zip/GZip library written entirely in C# for the .NET platform. It is implemented as an assembly, and thus can easily be incorporated into other projects (in any .NET language). The creator of NZipLib put it this way: "I've ported the zip library over to C# because I needed gzip/zip compression and I didn't want to use libzip.dll or something like this. I want all in pure C#."

Mike Woodring has a whole bunch of very useful samples on Remoting, Reflection, Threading and more.

Reflector for .NET

Reflector is a class browser for .NET components and assemblies. It features hierarchical assembly and namespace views, type and member dictionary index search, type reference search, custom attributes view, an IL disassembler and viewers for C# XML documentations and MSDN help. Assembly dependency trees, supertype/subtype hierarchies and resources can be inspected as well. Function prototypes are displayed in C#, VB and Eiffel syntax. Windows XP enabled. In short: the swiss army knife for .NET programmers.

Reflector is the first thing I put on any .NET system. The site has some other very cool tools too!

Chris Sells: Genghis

Genghis is a set of extensions built on top of .NET and integrated with WinForms to provide application-level services in the same flavor as the Microsoft Foundation Classes. Genghis gets its name as the functional heir to Attila, a similar set of functionality built on top of ATL.

Chris Sells: .NET XsdClassesGen

XsdClassesGen is a Custom Tool Add-In to VS.NET to generate type-safe wrapper classes for serializing to and from XML documents. It takes as input an XSD and produces the C# or VB.NET code to do the serialization using the XmlSerializer. This is really just the output of running xsd.exe /classes, but integrated directly into VS.NET.

If you'd like to know more about what a custom tool is and how to build your own, check out CollectionGen.

CollectionGen is a Custom Tool Add-In to VS.NET to generate type-safe collections. As it turns out, I did almost none of the work. Jon Flanders figured out how to add a custom tool. Shawn Van Ness implemented the template for type-safe collections. I just put it together.

CollectionGen is an add-on to generate code for type-safe collections until we have templates in C# (likely) and VB (unlikely). The benefit of a type-safe collection, of course, is that you can use it without having to cast items to and from objects. Also, Shawn has been very careful to implement a collection class that is very efficient for both reference types and value types.

 



9:48:37 PM    

Managed Provider to MySQL Released


eInfoDesigns.com is proud to announce the general availability of dbProvider, the managed provider to the MySQL database. dbProvider provides a direct, native connection between .NET and MySQL, bypassing the slower and error-prone OLEDB and ODBC interfaces.
Product Release. May 29, 2002.

9:21:52 PM    


© Copyright 2002 Sam Gentile.



Click here to visit the Radio UserLand website.

 


May 2002
Sun Mon Tue Wed Thu Fri Sat
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  
Apr   Jun

Click on the coffee mug to add Sam Gentile's Instant Outline to your Radio UserLand buddy list.