Home All Groups Group Topic Archive Search About

Dynamic assemblies across multiple sites

Author
28 Aug 2006 8:10 PM
dehoff
This post is concerning .NET 2.0 using C#.

I've created an assembly(globalUtils.cs) which will house any code that
all of our internal sites will use, such as a GetCurrentStockPrice()
function.  This .cs file resides in a global folder, and every site has
a virtual directory "/global" which points to this global folder.  This
is so I can have GAC-like functionality without requiring all of our
50+ developers to buy Visual Studio.

I included the following in the global.asax file for each site:

<%@ Assembly Src="~/global/globalUtils.cs"  %>
<object id="UtilsObj" runat="server" class="Company.GlobalUtils"
scope="Application" />

This allows me to call UtilsObj.GetCurrentStockPrice() from any .aspx
page.

The problem is trying to access the GlobalUtils assembly from a .cs
codebehind.  If I access a static string variable defined on
GlobalUtils, it works just fine.  If I try to instantiate the
GlobalUtils class and use it's non-static methods, I get the error:

The type or namespace name 'GlobalUtils ' does not exist in the
namespace 'Company' (are you missing an assembly reference?)

Anyone have any thoughts on why this is occuring, or have any
recommendations on a better way to accomplish my goals?

Thanks

AddThis Social Bookmark Button