0

I have a solution in VS 2008 which has one web project and 3 Class libraries as 3 different Projects. One project is for DataAccess and one is for BusinessLogic.

I have a class in DataAccessLayer. From there when I am trying to access the Class of BusinessLogic class library (project) it is not coming in the IntelliSense when I type. I used the same namespace in both projects. Still same results.

Do I need to to create DLLs for the first project and add as reference to second?

4 Answers 4

6

You need to add reference to this project in another project in your soultion. Visual studio has an option to add project as a reference, so you don't have to add assembly files directly

1
  • 1
    The classes also have to be publicly available.
    – user47589
    Jul 22, 2009 at 18:32
5

You need to reference the library in the other projects.

To do that, right-click the references folder in the Solution Explorer, click Add Reference, go to the Projects tab, and select the library that you want to reference.

EDIT: Also, make sure that the class you are trying to use is declared as public (eg, public class MyClass).

If you leave out the public modifier (which is the default), the class will only be usable in its project. To expose classes and members to other projects, add the public modifier to their declaration

1
  • Hey! Did you steal my answer?! 8^D
    – Dillie-O
    Jul 22, 2009 at 18:26
2

You'll need to add a reference to the project containing the BusinessLogic class in the DataAccess project. Otherwise, the compiler doesn't have anyway of finding the implementation of your BusinessLogic class, even if it does use the same namespace.

1

This may sound silly, but have you specified the class in question as Public or Friend? They'll need to be "shared" in that sense in order to be properly picked up and used within the other applications, even when the project reference is specified.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.