471,319 Members | 1,411 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

The type or namespace name 'MyClass' could not be found (are you missing a using directive or an assembly reference?)

What is the procedure for using a class defined in the same solution
but in another project?
The language I am using is c-sharp.

I have a solution with two projects in it. A c-sharp program in
project1 uses MyClass, which is defined in project2. In the solution
properties I set project1 to depend on project2.

I keep getting the "type or namespace name 'MyClass' could not be
found" error.

I defined a namespace in project2 and made sure MyClass was encompassed
by this namespace. Then I put the "using namespace" statement in the
project1 program.
This did not help.

Any suggestions?

Dec 25 '05 #1
4 4673

carqs123 wrote:
What is the procedure for using a class defined in the same solution
but in another project?
The language I am using is c-sharp.

I have a solution with two projects in it. A c-sharp program in
project1 uses MyClass, which is defined in project2. In the solution
properties I set project1 to depend on project2.

I keep getting the "type or namespace name 'MyClass' could not be
found" error.

I defined a namespace in project2 and made sure MyClass was encompassed
by this namespace. Then I put the "using namespace" statement in the
project1 program.
This did not help.

Any suggestions?


I'm not entirely sure what you are trying to say here, but I think your
answer is to add a reference to the other project. Fully qualifying
your
calls to the secondary namespace class (i.e. Namespace2.MyClass2)
wouldn't hurt either :)

Matt

Dec 25 '05 #2
Matt wrote:
I'm not entirely sure what you are trying to say here, but I think your
answer is to add a reference to the other project. Fully qualifying
your
calls to the secondary namespace class (i.e. Namespace2.MyClass2)
wouldn't hurt either :)


Right. How does one do that?

I tried using Namespace2.MyClass2 in using statement and variable
definitions.
I get... "type or namespace Namespace2 could not be found..."

How does one "add a reference" ?

Dec 26 '05 #3

carqs123 wrote:
Matt wrote:
I'm not entirely sure what you are trying to say here, but I think your
answer is to add a reference to the other project. Fully qualifying
your
calls to the secondary namespace class (i.e. Namespace2.MyClass2)
wouldn't hurt either :)


Right. How does one do that?

I tried using Namespace2.MyClass2 in using statement and variable
definitions.
I get... "type or namespace Namespace2 could not be found..."

How does one "add a reference" ?


In the solution explorer view, you will see a list of references. Right
click on it
and you'll see "add". Just use that. The references are near the top,
right below
the solution name.
Matt

Dec 26 '05 #4
OK OK, figured it out. Right mouse click on the references folder in
the solutions explorer. Add Reference. Thank you.

Dec 26 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Rookie | last post: by
6 posts views Thread by antonyliu2002 | last post: by
3 posts views Thread by =?Utf-8?B?QUEyZTcyRQ==?= | last post: by
reply views Thread by rosydwin | last post: by

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.