2

I have two projects in the current solution:

abc.Dashboard
abc.ThingyService

abc.ThingyService needs to be able to use a class from abc.Dashboard.

I've added a reference to abc.ThingyService pointing at abc.Dashboard (right click on project -> add reference -> projects -> abc.Dashboard) but it's not recognising that it has been added.

One of the files in the abc.ThingyService project contains:

using abc.Dashboard.Services

When I compile, I get the error:

The type or namespace name 'Dashboard' does not exist in the namespace 'abc' (are you missing an assembly reference?)   

Am I missing something very obvious here? :/

sapi
  • 9,944
  • 8
  • 41
  • 71

2 Answers2

1

Do you see the entry for Dashboard under the references section of ThingyService project in solution explorer ?

I would give a try to these steps.

1) Remove the reference and readd again and see.

2) Close Visual Studio and reopen it and see

3) Try to add the Project reference instead of selecting the dll while adding the reference.

4) Right click and build the Dashboard project and then build the ThingyService project. If that works, you probably need to check your build order.

Arne Evertsson
  • 19,693
  • 20
  • 69
  • 84
Shyju
  • 214,206
  • 104
  • 411
  • 497
0

I believe you also need to add the project as a dependency.

http://msdn.microsoft.com/en-us/library/et61xzb3(v=vs.80).aspx

This determines build order, making sure that the linked project has been compiled first.

Daryl Teo
  • 5,394
  • 1
  • 31
  • 37
  • 2
    Thanks for the help, but that wasn't it. As it turns out, this question had the answer: http://stackoverflow.com/questions/5825867/random-assembly-references-fail-are-you-missing-a-using-directive-or-an-assemb For some reason, the second project was defaulting to targeting .NET Client Profile. I have no idea what this is or why it caused the problem, but changing that fixed it. – sapi Jan 05 '12 at 04:42