Author: jonpryor
Date: 2005-09-07 08:46:08 -0400 (Wed, 07 Sep 2005)
New Revision: 49631

Modified:
   trunk/mcs/tools/mono-shlib-cop/ChangeLog
   trunk/mcs/tools/mono-shlib-cop/mono-shlib-cop.cs
Log:
  * mono-shlib-cop.cs: Use Assembly.LoadWithPartialName instead of
    Assembly.Load(AssemblyName) for loading -r: assemblies, since this
    actually works (though it's also deprecated in .NET 2.0, with no
    replacement).  If the first LoadWithPartialName fails, try again after
    removing any .dll extension (since the .dll isn't part of the assembly
    name, but I often specify it anyway).


Modified: trunk/mcs/tools/mono-shlib-cop/ChangeLog
===================================================================
--- trunk/mcs/tools/mono-shlib-cop/ChangeLog    2005-09-07 12:33:05 UTC (rev 
49630)
+++ trunk/mcs/tools/mono-shlib-cop/ChangeLog    2005-09-07 12:46:08 UTC (rev 
49631)
@@ -1,5 +1,14 @@
 2005-09-07  Jonathan Pryor  <[EMAIL PROTECTED]>
 
+       * mono-shlib-cop.cs: Use Assembly.LoadWithPartialName instead of
+         Assembly.Load(AssemblyName) for loading -r: assemblies, since this
+         actually works (though it's also deprecated in .NET 2.0, with no
+         replacement).  If the first LoadWithPartialName fails, try again after
+         removing any .dll extension (since the .dll isn't part of the assembly
+         name, but I often specify it anyway).
+
+2005-09-07  Jonathan Pryor  <[EMAIL PROTECTED]>
+
        * mono-shlib-cop.cs: Patch from John Luke to fix use of Path.Combine 
(don't
          want to use an `/'-prefixed path as the 2nd parameter) and improve XML
          node selection.

Modified: trunk/mcs/tools/mono-shlib-cop/mono-shlib-cop.cs
===================================================================
--- trunk/mcs/tools/mono-shlib-cop/mono-shlib-cop.cs    2005-09-07 12:33:05 UTC 
(rev 49630)
+++ trunk/mcs/tools/mono-shlib-cop/mono-shlib-cop.cs    2005-09-07 12:46:08 UTC 
(rev 49631)
@@ -242,16 +242,25 @@
 
                public void CheckWithPartialName (string partial, 
AssemblyCheckInfo report)
                {
-                       AssemblyName an = new AssemblyName ();
-                       an.Name = partial;
-                       try {
-                               Assembly a = Assembly.Load (an);
-                               Check (a, report);
-                       }
-                       catch (FileNotFoundException e) {
+                       string p = partial;
+                       Assembly a;
+                       bool retry;
+
+                       do {
+                               a = Assembly.LoadWithPartialName (p);
+                               retry = p.EndsWith (".dll");
+                               if (retry) {
+                                       p = p.Substring (0, p.Length-4);
+                               }
+                       } while (a == null && retry);
+
+                       if (a == null) {
                                report.Errors.Add (new MessageInfo (null, null, 
-                                       "Could not load assembly reference `" + 
partial + "': " + e.Message));
+                                       "Could not load assembly reference `" + 
partial + "'."));
+                               return;
                        }
+
+                       Check (a, report);
                }
 
                private void Check (Assembly a, AssemblyCheckInfo report)

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to