This question already has an answer here:
I have a C#
solution with several projects in Visual Studio 2010
.
One is a test project (I'll call it "PrjTest"), the other is a Windows Forms Application
project (I'll call it "PrjForm"). There is also a third project referenced by PrjForm, which it is able to reference and use successfully.
PrjForm references PrjTest, and PrjForm has a class with a using
statement:
using PrjTest;
- Reference has been correctly added
using
statement is correctly in place- Spelling is correct
- PrjTest builds successfully
- PrjForm almost builds, but breaks on the
using PrjTest;
line with the error:
The type or namespace name 'PrjTest' could not be found (are you missing a using directive or an assembly reference?)
I've tried the following to resolve this:
- Removed Resharper (since Resharper had no trouble recognizing the referenced project, I thought it might be worth a shot)
- Removed and re-added the reference and using statement
- Recreated PrjForm from scratch
- PrjForm currently resides inside the PrjTest folder, I tried moving it to an outside folder
- Loaded the solution on a different computer with a fresh copy of
VS 2010
I have done my homework and spent far too long looking for an answer online, none of the solutions has helped yet.
What else could I try?
check your Project Properties, your Reference Paths should be empty like this:
Regards
I had the same issue. The target frameworks were fine for me. Still it was not working. I installed VS2010 sp1, and did a "Rebuild" on the PrjTest. Then it started working for me.
just changed Application's target framework to ".Net Framework 4".
And error got Disappeared.
good luck; :D
If your project (PrjTest) does not expose any public types within the
PrjTest
namespace, it will cause that error.Does the project (PrjTest) include any classes or types in the "PrjTest" namespace which are public?
It is also possible, that the referenced projects targets .NET 4.0, while the Console App Project targets .NET 4.0 Client Library.
While it might not have been related to this particular case, I think someone else can find this information useful.
This worked for me too. Thanks a lot. I was trying an RDF example for dotNet where in I downloaded kit from dotnetrdf.
NET4 Client Profile: Always target NET4 Client Profile for all your client desktop applications (including Windows Forms and WPF apps).
NET4 Full framework: Target NET4 Full only if the features or assemblies that your app need are not included in the Client Profile. This includes: If you are building Server apps, Such as:
If you use legacy client scenarios, Such as: o Use System.Data.OracleClient.dll which is deprecated in NET4 and not included in the Client Profile.
If you targeting developer scenarios and need tool such as MSBuild or need access to design assemblies such as System.Design.dll