# [.net] ASP.net and Custom Built Libraries

This topic is 4426 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, I've been having problems for awhile now with this. I made a couple classes that pretty much encapsulate the already simple to use ADO.net SQL objects and such (just to make it simplier for me..I work with them all the time). I put these classes in a .DLL and can use these classes fine on my local machine, but once I upload them to the web it always says i'm missing a reference to the assembly. (I've tried many things and i'm now just giving up on that idea)... A quick work around was that I could just place the classes in every code-behind file (like Default.aspx.cs)..This worked fine and dandy in ASP.net 1.1, but since I upgraded to ASP.net 2.0 it often tells me that the classes are already registered in the <global assembly> (or something like that)...I'm not sure what that means, but it doesn't happen every time.. I don't know enough about the compilination process to know what it's trying to do or why it's trying to do that. So my question is...What do you guys do? I mean no doubt other people besides me have created classes or libaries that need to be used in multiple files? How do you include the classes that you need? Funny I thought ASP.net 2.0 was suppose to be more advanced and easier than Classic ASP...Would be nice if you could just do an <%@include file%> or something... Looking forward to your responses.. Ratings to all that help. ArchG

##### Share on other sites

Not quite sure what your problem is, but here's what I do:

I create a web project for the frontend, and I create class library project (for the businesslogic) in the same solution. In the web-project: right click bin -> Add Reference, and reference the class library project (!! not the dll).

Quote:
 mean no doubt other people besides me have created classes or libaries that need to be used in multiple files? How do you include the classes that you need?

Hmmm... do you mean
using myclasslibrary.businesslogic;

?

Quote:
 This worked fine and dandy in ASP.net 1.1, but since I upgraded to ASP.net 2.0 it often tells me that the classes are already registered in the (or something like that)...I'm not sure what that means, but it doesn't happen every time..

You are probably using shared assemblies that reside in the Global Assembly Cache (GAC). GAC was created to resolve dll-sharing problems. Search MSDN
: http://support.microsoft.com/default.aspx?scid=kb;en-us;315682

I'm not sure what the exact problem is, so need more info.

Edo

##### Share on other sites

I was actually using Visual Web Developer 2005 Express Edition, and it wasn't compiling my code...

I tried what you said with VS.net 2005, and it worked fine again on my local machine..I published the website fine, but when I try to use the simple web application it gives me a..
Could not load the assembly 'App_Web_z165e0r4'. Make sure that it is compiled before accessing the page.

error...Here is the Source snippet it shows..

<%@ page language="C#" autoeventwireup="true" inherits="_Default, App_Web_z165e0r4" %>

The funny thing is, that in my actualy Default.aspx page, it says
Inherits="_Default"
...So i'm unsure what it's trying to do here..

I tried publishing to 2 different webservers...the same happened on each of them, except the App_Web_z165e0r4 had a different ending..

anyone else have this problem?

##### Share on other sites
After looking through the directories a bit, I found that when publishing it, it actually changes the Default.aspx to add that line..

and..inside the Bin directory, it put a App_Web_z165e0r4.dll..but none the less it still gives me that error
Could not load the assembly 'App_Web_z165e0r4'. Make sure that it is compiled before accessing the page

..thoughts anyone?

##### Share on other sites

Well,

You might try not publishing your website, since MS is a strong supporter of xcopy deployment anyway. Technically, the only thing you need to do to publish your website is:

- copy aspx pages
- copy ascx pages
- copy directory 'bin'
- copy graphics files / css files etc

Edo

1. 1
2. 2
Rutin
24
3. 3
4. 4
JoeJ
18
5. 5

• 14
• 28
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631772
• Total Posts
3002260
×