1

I know this questions has been asked a lot and I read pretty much all of the answers. I even checked .NET versions and they are same. I wrote a Rectangle class in project called Problem1 (namesapce Problem1) and wanted to use it in another project Problem2. I added using Problem1 and it immediately got red saying:

"type or namespace name could not be found" 

Now I compared mine solution to a working one, which is written exactly the same, yet mine is not working. What can I do to fix this?

1
  • 3
    Did you add Problem1 as reference to Problem2? Commented Jan 7, 2017 at 16:51

1 Answer 1

3

You have to add a reference to the project Problem1 in project Problem2

In solution Explorer:

1- right click on Project Problem2 and click on add reference

2- In the dialog that appears in the left pane click on Solution

3- In projects that appear after clicking the solution, select the project Problem1

4- click ok

Sign up to request clarification or add additional context in comments.

2 Comments

it worked, thanks. One more question if you have time. when I go on to make object of class recangle i get an error: rectangle is inaccessible due to its protection level
You have to declare the rectangle class either as public or internal

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.