2012-09-07 175 views
0

我从Windows XP迁移到Windows 7我的开发机器上后,遇到了一些怪异的行为。WPF奇怪的生成文件错误

我在Visual Studio 2010中的解决方案中创建一个WPF 4溶液3个项目 - 通用,MyApp的和基础设施。我使用的是Prism 4.原来的解决方案是在Windows XP上创建的,由于各种原因,我正在将它重建为新的解决方案。我已经添加了Common和MyApp,并且都可以独立成功构建。这个问题与基础设施有关。

要重建我所创建的项目文件夹,并添加现有的代码文件的项目。当我开始测试构建时,它很好。进入所有的文件,我现在收到这样的错误,当试图建立(Resharper建议一切都很好);

The type or namespace name 'Windows' does not exist in the namespace 'Infrastructure.System' (are you missing an assembly reference?) CircularProgressBar.g.cs 
The type or namespace name 'Windows' does not exist in the namespace 'Infrastructure.System' (are you missing an assembly reference?) CircularProgressBar.xaml 
The type or namespace name 'Delegate' does not exist in the namespace 'Infrastructure.System' (are you missing an assembly reference?) SearchView.g.cs 
The type or namespace name 'CodeDom' does not exist in the namespace 'Infrastructure.System' (are you missing an assembly reference?) CircularProgressBar.g.cs 

常见的主题是列出的所有文件都与XAML相关。基础设施项目是WPF用户控制的一个,所有的xaml文件都有页面的构建操作。

现在很奇怪的一点。为了试图找出问题出在哪里,我开始逐个从项目中排除文件夹。我从InteractionRequests开始,因为我一直在这里烦恼。不用找了。然后我排除下一个(系统)和低,看到解决方案构建并显示主窗口。于是,我开始一个多增加一个 - 例如,如果我在

namespace Infrastructure.System 
{ 
    public enum TypeOfUser 
    { 
    User, 
    Admin  
    } 

    public enum TypeOfTrialUser 
    { 
    User, 
    Admin 
    } 

    public enum UserAccessStatus 
    { 
    Granted, 
    Revoked 
    } 
} 

错误返回添加用户类型回来。再次排除它们,它们就消失了。与其他文件一样的故事也是如此,因此与文件本身无关(正如您期望的那样)。当错误返回时,它仍然引用xaml相关文件(* .xaml或* .g.cs)的相同列表。

任何想法?我不得不承认我完全被这个困惑了!可能与文件权限有关?束手无策达到.....

回答

0

嗯,我解决了,但我真的不知道为什么这是一个问题。关键是命名空间Infrastructure.System - 将其重命名为Infrastructure.Sys,成功更新使用语句和所有构建。某种毛病?

+0

看到了这个问题,并将其链接了解更多详情MSDN文章:http://stackoverflow.com/questions/580577/how-do-i-make-a-namespace-containing-system-in-net-without-它冲突 –