onur demir
onur demir

Reputation: 431

"The type or namespace could not be found" error while building a project

I am getting this error while trying to build a solution:

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

The error and the red lines disappear when I open the error list and click on it. I can see the missing dll file is recognized by that class and it is also listed in the references.

I searched many questions here but none of them worked for me. Here is a list of things I tried so far that might help to understand the problem.

Upvotes: 0

Views: 864

Answers (1)

onur demir
onur demir

Reputation: 431

I have changed build output to Diagnostic then inspected errors.

enter image description here

I have found this line and changed all projects target version from 4.6 to 4.6.2 and it worked.

Dll could not be resolved because it was built against the ".NETFramework,Version=v4.6.2" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.6".

Upvotes: 3

Related Questions