0

I just moved a couple of WPF User controls from one project to another and now I get all these errors when I compile, the same namespaces are said to be missing from all the user controls CodeDom, Windows, Diagnostics and ComponentModel

Error   9   The type or namespace name 'CodeDom' does not exist in the namespace 'Brodit.Etikettsystem.Modules.System' (are you missing an assembly reference?) C:\Users\per\Desktop\Etikettsystem\Brodit.Etikettsystem.Modules\obj\Debug\Customers\CustomersView.g.cs  48  17  Brodit.Etikettsystem.Modules
Error   1   The type or namespace name 'Windows' does not exist in the namespace 'Brodit.Etikettsystem.Modules.System' (are you missing an assembly reference?) C:\Users\per\Desktop\Etikettsystem\Brodit.Etikettsystem.Modules\obj\Debug\Customers\CustomersView.g.cs  40  49  Brodit.Etikettsystem.Modules
Error   7   The type or namespace name 'Diagnostics' does not exist in the namespace 'Brodit.Etikettsystem.Modules.System' (are you missing an assembly reference?) C:\Users\per\Desktop\Etikettsystem\Brodit.Etikettsystem.Modules\obj\Debug\Customers\CustomersView.g.cs  47  17  Brodit.Etikettsystem.Modules

After the move I changed all the namespaces to match the new project name, I've tried deleting the obj folder and running custom tool for all the xaml files. Any ideas on what I should do to fix this.

Dave Clemmer
  • 3,741
  • 12
  • 49
  • 72
Pelle
  • 2,755
  • 7
  • 42
  • 49

2 Answers2

1

These are .NET Framework namespaces. It looks like some WPF and System libraries are missing from the target project.

Have you tried to copy the XAML files to a Class library project? If so, you should add the proper references to the target project.

Another possibility is that your project targets .NET Framework 2.0 which doesn't include the WPF libraries.

Most System.Windows classes (including Window) are defined in PresentationFramework.dll

Panagiotis Kanavos
  • 120,703
  • 13
  • 188
  • 236
  • Thanks for replying! The target project is a WPF User Controls project so all the references are there as far as I can see. PresentationCore, PresentationFramework, WindowsBase etc. I have another project in the solution with the exact same set of references that do compile – Pelle Dec 12 '12 at 10:13
  • And do the view files contain the proper using statements? Try to open the files specified in the message to see what they contain. The compiler can't find the using statements in the files and tries to find the namespaces in the project's default namespace. The .g.cs files are generated by Visual Studio for each .xaml file before compilation. – Panagiotis Kanavos Dec 12 '12 at 10:18
  • Everything looks ok, the project I moved to already had a couple of xaml files that did compile before I moved the other ones in there. – Pelle Dec 12 '12 at 10:35
  • Aw man! I looks like the problem is MY namespace `Brodit.Etikettsystem.Modules.System` I changed the `System` part to `SystemModules` and now it all compiles. Thanks for helping out! – Pelle Dec 12 '12 at 10:47
0

I looks like the problem is MY namespace Brodit.Etikettsystem.Modules.System I changed the System part to SystemModules and now it all compiles.

Pelle
  • 2,755
  • 7
  • 42
  • 49