473,382 Members | 1,424 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Installing Assembly in GAC

Hi folks,

I've written an application that (in a very cut down form) looks like
this:

namespace Opus2.Page {
public class Admin : System.Web.UI.Page {
public void Page_Load(object sender, EventArgs e) {
...
}

...
}
}

I have compiled it as a DLL file, copied it to the /bin directory for my
virtual host, and I am referencing it from my ASPX file like:

<%@ Page language="C#" Inherits="Opus2.Page.Admin"
validateRequest="false" %>

Now this assembly is used by several websites hosted on the same server,
so I thought what better way than to stick it in the GAC and be done
with it. That way, I thought, I could simply update the one DLL file
whenever I find bugs etc and all of the websites using it would reflect
the changes immediately.

So I created a strong name key, associated it with the assembly,
recompiled and copied it to the GAC. Then I deleted it from the /bin
directory for the virtual host and tried to reload the page. Didn't
work. Now I get the following message:

Parser Error Message: Could not load type 'Opus2.Page.Admin'.

So now I am a bit confused. My first thought is that maybe I can't have
a class that inherits System.Web.UI.Page in GAC in the way that I have
done it. Is it actually possible to do this?

Secondly, if it is impossible to do it this way, is it possible to
create a "helper" DLL file, in the /bin directory of the virtual host,
that contains no real code but uses the Opus2.dll file from the GAC to
accomplish what I was trying to do?

Thirdly, if none of the above, is there any alternative method that will
allow me to have one central copy of the DLL file used by all the sites?

I asked a similar question some time ago, but at that point I was using
shared hosting and did not have access to the server, but I am now
operating my own server and have full admin rights to mess everything up
should I choose to do so ;) So there are no limitations/restrictions as
to what I can do this time round!

Cheers,

--
Dylan Parry
http://electricfreedom.org -- Where the Music Progressively Rocks!
Jun 12 '06 #1
2 1649
Dylan Parry wrote:
So now I am a bit confused. My first thought is that maybe I can't have
a class that inherits System.Web.UI.Page in GAC in the way that I have
done it. Is it actually possible to do this?

[...]

As it turns out, it is entirely possible to do this, but I needed to
reference the assembly in the web.config file like:

<add assembly="Opus2, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=d65b870916fbf4c7" />

So that the runtime knew where to look for it. It seems a bit strange
that you need to do this, IMHO, in that putting something in an
established global location then telling the runtime where to find it
seems a bit redundant to me.

Anyway, it now works just fine, as long as I remember to change the
web.config whenever I change the version number for the assembly!

--
Dylan Parry
http://webpageworkshop.co.uk -- FREE Web tutorials and references
Jun 12 '06 #2
I don't think you can put something you inherit from the web,ui in GAC. I
have try it with a class but not something with an UI.

chanmm

"Dylan Parry" <us****@dylanparry.com> wrote in message
news:8a***************@dylanparry.com...
Hi folks,

I've written an application that (in a very cut down form) looks like
this:

namespace Opus2.Page {
public class Admin : System.Web.UI.Page {
public void Page_Load(object sender, EventArgs e) {
...
}

...
}
}

I have compiled it as a DLL file, copied it to the /bin directory for my
virtual host, and I am referencing it from my ASPX file like:

<%@ Page language="C#" Inherits="Opus2.Page.Admin"
validateRequest="false" %>

Now this assembly is used by several websites hosted on the same server,
so I thought what better way than to stick it in the GAC and be done
with it. That way, I thought, I could simply update the one DLL file
whenever I find bugs etc and all of the websites using it would reflect
the changes immediately.

So I created a strong name key, associated it with the assembly,
recompiled and copied it to the GAC. Then I deleted it from the /bin
directory for the virtual host and tried to reload the page. Didn't
work. Now I get the following message:

Parser Error Message: Could not load type 'Opus2.Page.Admin'.

So now I am a bit confused. My first thought is that maybe I can't have
a class that inherits System.Web.UI.Page in GAC in the way that I have
done it. Is it actually possible to do this?

Secondly, if it is impossible to do it this way, is it possible to
create a "helper" DLL file, in the /bin directory of the virtual host,
that contains no real code but uses the Opus2.dll file from the GAC to
accomplish what I was trying to do?

Thirdly, if none of the above, is there any alternative method that will
allow me to have one central copy of the DLL file used by all the sites?

I asked a similar question some time ago, but at that point I was using
shared hosting and did not have access to the server, but I am now
operating my own server and have full admin rights to mess everything up
should I choose to do so ;) So there are no limitations/restrictions as
to what I can do this time round!

Cheers,

--
Dylan Parry
http://electricfreedom.org -- Where the Music Progressively Rocks!

Jun 12 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dan | last post by:
Hi when installing a shared assembly into the GAC, do I have to check whether the GAC already have the assembly with the same strong name(name,version,publickeytoken and culture) before...
5
by: McGeeky | last post by:
Is it possible to install an assembly on a remote machine's GAC? I don't see an option for it using gacutil.exe -- McGeeky http://mcgeeky.blogspot.com
0
by: Ed | last post by:
Hi, I have to install a service in my PC which has been developed by my company. While installation the System.Reflection.ReflectionTypeLoadException exception is thrown. And the log is as...
7
by: Adam | last post by:
Im trying to add an httphandler for all *.sgf file extensions. I have developed the handler, 1. installed it into the gac 2. added it to the machine.config: <httpHandlers> <add verb="*"...
11
by: tshad | last post by:
I have a small Windows Service program that just has a timer on it and it built fine. I try to install it using InstallUtil and I get the following message: ...
2
by: J | last post by:
hi, I'm having a problem installing a service created in vb.net 2003 on a windows 2000 server. I have installed the service on a few XP machines with out any problems...but the 2 servers (win...
0
by: Anonieko Ramos | last post by:
Self Installing Service Enter a topic name to show or a new topic name to create; then press Enter .. Start by writing a service. This involves deriving a class from...
0
by: Dave O | last post by:
Has anyone had experience loading a previous version of an assemblie's settings when installing a newer version of the assembly? for example, the old assembly version is 1.0.0.0 and its settings...
0
by: job | last post by:
Mohamed Sharaf's has produced a Microsoft.Practices.EnterpriseLibrary production server installer: https://blogs.msdn.com/mohamed_sharafs_blog/archive/2005/09/18/470854.aspx Running the...
15
by: =?Utf-8?B?RWxpb3Ro?= | last post by:
I try to install Windows Services but it show this error during the installation process, "Insufficient System resources exist to complete the requested service." I created this Services in VB...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.