Asked  6 Months ago    Answers:  2   Viewed   53 times

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;
  1. Reference has been correctly added
  2. using statement is correctly in place
  3. Spelling is correct
  4. PrjTest builds successfully
  5. 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:

  1. Removed Resharper (since Resharper had no trouble recognizing the referenced project, I thought it might be worth a shot)
  2. Removed and re-added the reference and using statement
  3. Recreated PrjForm from scratch
  4. PrjForm currently resides inside the PrjTest folder, I tried moving it to an outside folder
  5. 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?

 Answers

80

See this question.

Turns out this was a client profiling issue.

PrjForm was set to ".Net Framework 4 Client Profile" I changed it to ".Net Framework 4", and now I have a successful build.

Thanks everyone! I guess it figures that after all that time spent searching online, I find the solution minutes after posting, I guess the trick is knowing the right question to ask..

Tuesday, June 1, 2021
 
jeremyharris
answered 6 Months ago
38

Try

using System.Windows.Media.Imaging.BitmapImage;

Instead of

using BitmapImage;

An easier way is to let Visual Studio do it for you : Right click on BitmapImage in your code -> resolve, and select the right namespace (there is generaly only one)

For the xaml, let Visual studio do it for you too, or :

<Page ...
    xmlns:local="clr-namespace:System.Windows;assembly=DiceRoll"
/>
Monday, August 23, 2021
 
Nasir
answered 4 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :
 
Share