Question Class Library Reference Disappearing Upon Compiling

ChetCromer

New member
Joined
Dec 30, 2011
Messages
2
Programming Experience
10+
I have a solution built of 3 projects:


1. VB.NET Class Library - data access and objects, reusable methods, etc.
2. ASP.NET Web app - web application that references the class library
3. VB.NET Windows Form app - windows app that references the class library


I have no problems with the web app. It referenes the class library and every time the project is built the web app gets a freshly compiled dll from the class library.


My problem is with the windows form app. When I first add the reference to the class library project, I get all of the intellisense I'd expect while coding. When I try to compile, though, it's like the reference disappears and all my code that is based on the class library errors out with "'xxx' is not declared" or "'xxx' is not defined" where 'xxx' is a method or class within the class library. If I go into the project properties, the reference is still there, but the project no longer compiles and I also lose intellisense for all classes within the class library. If I remove and re-add the reference, it works again, until I try to compile. Then the errors occur again.


I've tried creating a separate Windows Forms project and just referencing the DLL created by the class library but get the same problem. HOWEVER, if I create a seperate blank WEB project and reference the dll (or the project), everything compiles fine. It seems to be something with my class library being referenced by a windows forms app.


For reference purposes, my class library has the following references:
system, system.cor, system.data, system.data.datasetextensions, system.drawing, system.web, system.xml, system.xml.linq


I noticed I can't add a reference to System.Web in my windows forms app, and I wonder if my problem is somewhere in this area. I need the reference is my class library because it passes some HttpContext objects back and forth to a few of the methods.


Any help or direction would be appreciated. This is a big project so I can't just copy and paste all of the code here, but if there's something specific you'd like to see, let me know.


Thanks,


Chet
 
I fixed this by changing the target framework of my Windows Forms app. It makes a little sense after reading this:
Can not find System.Web in add reference.
I changed it from ".NET Framework 4 Client Profile" to ".NET Framework 4"
The key seems to be that the client profile target doesn't include some key references (like those needed by a web server) to save on space and # of references...
To change this I went here:
project properties / compile / advanced - changed target framework from ".net framework 4 client profile" to ".net framework 4"
 

Latest posts

Back
Top