我只是将几个WPF用户控件从一个项目移到了另一个项目,现在在编译时遇到了所有这些错误,据说所有用户控件CodeDom,Windows,Diagnostics和ComponentModel都缺少相同的 namespace
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
最佳答案
这些是.NET Framework namespace 。看起来目标项目中缺少某些WPF和系统库。
您是否尝试过将XAML文件复制到类库项目中?如果是这样,则应将适当的引用添加到目标项目。
另一种可能性是您的项目面向不包含WPF库的.NET Framework 2.0。
大多数System.Windows类(包括Window)在PresentationFramework.dll中定义
https://stackoverflow.com/questions/13837213/