Question

  • I create a new solution called "WordpressAutomation"
  • I create a new project, a class library, called "WordpressAutomation" in this solution
  • I create a new project, a unit test project, called WordpressTests in this solution
  • I add a reference to the project WordpressAutomation in the project WordpressTests"

This should be ok, shouldn't it?

However, as can be seen from the screenshot, when adding this using line in a class in the project WordpressTests, the reference doesn't work. Even though it is there, as can plainly be seen.

When entering "using", the class library "WordpressAutomation" doesn't appear among the alternatives. And I get this error message when trying to run:

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

Why is this happening? The reference is clearly there?

https://i.stack.imgur.com/L0g5R.png

Was it helpful?

Solution

Your project isn't actually including the .cs files to compile; they are only shown for information (they should appear as solid files with the C# logo):

enter image description here

Right click on these files and include them in the project. Then check what namespace they declare inside them. At the moment, your WordpressAutomation project simply doesn't contain any types.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top