0

I've added two c# class library projects to a Windows Application project, they turn up as expected and I can write some code that references the namespaces which are both declared at the top of the class (using) and the intellisense and syntax highlighting works as expected, but as soon as I build the code it tells me that the namespaces can't be found and asks me whether I'm missing a reference... the syntax highlighting also disappears. If I remove the references and add them again the highlighting comes back until I build it again and then the cycle just repeats itself. Any clues would be greatly appreciated.

I've tried cleaning the entire solution and also restarting VS.

As per commment/answer:

I had a reference to System.Web in the class project with a target of ".Net Framework 4" the Win Forms app was set to ".Net Framework 4 Client Profile" and wouldn't allow me to add System.Web, changing it to just ".Net Framework 4" fixed the issue

1
  • Check both project Target Framework, Are both same or not. Commented Oct 28, 2012 at 3:13

1 Answer 1

2

Check both project Target Framework, Are both same or not.

The issue can be that your are referencing a higher Target Framework project into a less Target Framework project.

Like If you have a project with Target Framework .Net Framework 4 and you are referencing it into a project with .Net Framework 4 Client Profile or .Net Framework 3.5, you will get the issue.

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

1 Comment

I had a reference to System.Web in the class project with a target of ".Net Framework 4" the Win Forms app was set to ".Net Framework 4 Client Profile" and wouldn't allow me to add System.Web, changing it to just ".Net Framework 4" fixed the issue

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.