wpf - WPF,将XAML文件移动到另一个项目

我只是将几个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

移动之后,我更改了所有命名空间以匹配新的项目名称,然后尝试删除obj文件夹并为所有xaml文件运行自定义工具。我应该采取什么措施解决此问题。

最佳答案

这些是.NET Framework namespace 。看起来目标项目中缺少某些WPF和系统库。

您是否尝试过将XAML文件复制到类库项目中?如果是这样,则应将适当的引用添加到目标项目。

另一种可能性是您的项目面向不包含WPF库的.NET Framework 2.0。

大多数System.Windows类(包括Window)在PresentationFramework.dll中定义

https://stackoverflow.com/questions/13837213/

相关文章:

python - scipy给出了 undefined symbol : clapack_sgesv

git - 移动git项目导致许多Blob和树错误

opengl - 使用UBO编译片段着色器时发生OpenGLSL错误

actionscript-3 - AS3错误1180调用IntelliJ中可能未定义的方法

gcc - 如何在 MinGW 中将错误消息控制设置为详细?

xcode - Xcode无法识别C++语法

Objective-C - 避免编译错误?

encoding - 在我的源代码中插入了额外的字符,它不会再编译了

android - BadTokenException无法添加窗口(ProgressDialog)

compiler-errors - 带有C++/CLI的VS2012中的错误C2039错误