Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Loading an assembly from the Global Assebly Cache


Message #1 by "Magnus Akselvoll" <makselvoll@h...> on Mon, 11 Feb 2002 09:27:23 +0100
Hi all.



I have a web application that tries to create a resource manager, based

on an assembly. This assembly is common for several applications, and is

therefore placed in the Global Assembly Cache (GAC).



Now, the problem is that an exception is thrown at runtime. The code is

as follows (from

Global.asax.cs):



//START CODE SNIPLET

protected void Application_Start(Object sender, EventArgs e)

{

	//This one is working

	Application["RM"] =3D

		new ResourceManager(

			"StringResources",

=09

System.Reflection.Assembly.Load("StringResources")

		);



	//DefaultSettings is a component that through

	GetResourceBaseName()

	//gives me the name of the resource file to load from within the

assembly

	DefaultSettings ds =3D new DefaultSettings();



	//The System.Reflection.Assembly.Load throws a

FileNotFoundException

	Application["CONFIG"] =3D

		new System.Resources.ResourceManager(

			ds.GetResourceBaseName(),

=09

System.Reflection.Assembly.Load("MyApplicationConfiguration")

		);

}

//END CODE SNIPLET



The first occurrance of Assebmly.Load works fine, as the dll file for

the assembly is in the bin directory of the web application. The second

one though fails. MyApplicationConfiguration.dll is common for several

application, and is therefore located in the Global Assembly Cache

(GAC).



My environment:

 - Windows XP PRO

 - Visual studio .net final version (.Net framework .Net framework

1.0.3705)

 - Applications created in Visual Studio .Net beta 2, but all components

(including the problem assembly) have been completely rebuilt in the

final version. No errors at compile time.



Does anybody know how to help me?



PS! To those reading he C# list, please excuse me for posting this

question here, after asking the same question there some days ago. But I

feel that it might maybe be more ASP.NET than C# related...

--

| Magnus Akselvoll   | +xx xxx xxx xxx           |

| Systems consultant | makselvoll@h... |

| HolteGroup SA      | Malaga - Spain            |

                                                --


  Return to Index