Author: mhabersack
Date: 2007-04-30 03:51:46 -0400 (Mon, 30 Apr 2007)
New Revision: 76475
Modified:
branches/mono-1-2-4/mcs/class/System.Web/System.Web.Compilation/AppCodeCompiler.cs
branches/mono-1-2-4/mcs/class/System.Web/System.Web.Compilation/ChangeLog
Log:
Backport of r76378
2007-04-27 Marek Habersack <[EMAIL PROTECTED]>
* AppCodeCompiler.cs: Resolve assembly names from the global web.config
to their
locations before passing them to the compiler provider.
Modified:
branches/mono-1-2-4/mcs/class/System.Web/System.Web.Compilation/AppCodeCompiler.cs
===================================================================
---
branches/mono-1-2-4/mcs/class/System.Web/System.Web.Compilation/AppCodeCompiler.cs
2007-04-30 07:50:20 UTC (rev 76474)
+++
branches/mono-1-2-4/mcs/class/System.Web/System.Web.Compilation/AppCodeCompiler.cs
2007-04-30 07:51:46 UTC (rev 76475)
@@ -44,6 +44,48 @@
namespace System.Web.Compilation
{
+ class AssemblyPathResolver
+ {
+ static Dictionary <string, string> assemblyCache;
+
+ static AssemblyPathResolver ()
+ {
+ assemblyCache = new Dictionary <string, string> ();
+ }
+
+ public static string GetAssemblyPath (string assemblyName)
+ {
+ lock (assemblyCache) {
+ if (assemblyCache.ContainsKey (assemblyName))
+ return assemblyCache [assemblyName];
+
+ Assembly asm = null;
+ Exception error = null;
+ if (assemblyName.IndexOf (',') != -1) {
+ try {
+ asm = Assembly.Load
(assemblyName);
+ } catch (Exception e) {
+ error = e;
+ }
+ }
+
+ if (asm == null) {
+ try {
+ asm =
Assembly.LoadWithPartialName (assemblyName);
+ } catch (Exception e) {
+ error = e;
+ }
+ }
+
+ if (asm == null)
+ throw new HttpException (String.Format
("Unable to find assembly {0}", assemblyName), error);
+
+ assemblyCache.Add (assemblyName, asm.Location);
+ return asm.Location;
+ }
+ }
+ }
+
internal class AppCodeAssembly
{
private List<string> files;
@@ -190,8 +232,8 @@
foreach (AssemblyInfo ai in
compilationSection.Assemblies)
if (ai.Assembly != "*") {
try {
- asmName = new
AssemblyName (ai.Assembly);
-
parameters.ReferencedAssemblies.Add (asmName.Name);
+
parameters.ReferencedAssemblies.Add (
+
AssemblyPathResolver.GetAssemblyPath (ai.Assembly));
} catch (Exception ex) {
throw new HttpException
(
String.Format
("Could not find assembly {0}.", ai.Assembly),
@@ -230,7 +272,7 @@
throw new CompilationException (null,
results.Errors, null);
}
}
-
+
private string PhysicalToVirtual (string file)
{
return file.Replace (HttpRuntime.AppDomainAppPath,
"/").Replace (Path.DirectorySeparatorChar, '/');
Modified:
branches/mono-1-2-4/mcs/class/System.Web/System.Web.Compilation/ChangeLog
===================================================================
--- branches/mono-1-2-4/mcs/class/System.Web/System.Web.Compilation/ChangeLog
2007-04-30 07:50:20 UTC (rev 76474)
+++ branches/mono-1-2-4/mcs/class/System.Web/System.Web.Compilation/ChangeLog
2007-04-30 07:51:46 UTC (rev 76475)
@@ -2,7 +2,9 @@
* AppCodeCompiler.cs: do not look at the number of errors, check
the compiler return code instead.
-
+ Resolve assembly names from the global web.config to their
+ locations before passing them to the compiler provider.
+
* AssemblyBuilder.cs: as above
* AppResourcesCompiler.cs: as above
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches