C# IOException未处理-找不到资源app.xaml

C# IOException未处理-找不到资源app.xaml,c#,.net,wpf,visual-studio-2010,C#,.net,Wpf,Visual Studio 2010,在我的一个WPF项目中,当我打开解决方案并在调试它时启动它时,我会遇到这个错误。如果我重新构建解决方案并重新启动它,错误就会消失 我通过使用以下命令删除App.xaml中的StartUpUri实现了对应用程序的命令行支持: 我如何摆脱这个恼人的错误 使用VS2010.NET4.0 System.IO.IOException was unhandled Message=Cannot locate resource 'app.xaml'. Source=PresentationFramew

在我的一个WPF项目中,当我打开解决方案并在调试它时启动它时,我会遇到这个错误。如果我重新构建解决方案并重新启动它,错误就会消失

我通过使用以下命令删除App.xaml中的StartUpUri实现了对应用程序的命令行支持:

我如何摆脱这个恼人的错误

使用VS2010.NET4.0

System.IO.IOException was unhandled
  Message=Cannot locate resource 'app.xaml'.
  Source=PresentationFramework
  StackTrace:
       at MS.Internal.AppModel.ResourcePart.GetStreamCore(FileMode mode, FileAccess access)
       at System.IO.Packaging.PackagePart.GetStream(FileMode mode, FileAccess access)
       at System.IO.Packaging.PackagePart.GetStream()
       at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
       at ESPS3.ServerSchemaUtility.App.InitializeComponent() in e:\ESP3.0\InternalTools\ServerSchemaUtility\ServerSchemaUtility\App.xaml:line 1
       at ESPS3.ServerSchemaUtility.App.Main() in E:\ESP3.0\InternalTools\ServerSchemaUtility\ServerSchemaUtility\obj\x86\Debug\App.g.cs:line 0
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 


我以前在从VS2005移植到2008时看到过这个错误。2010年从未见过。 由于某些原因,app.xaml的生成设置丢失。因此,您可以检查app.xaml的属性。正确的设置显示在所附的图像中


另一方面,如果您使用的是MVVC,则可能是另一种原因,如此处所述:

我的情况与问题(VS2010)中指定的情况相同。
昨天,该项目顺利完成。今天,在代码没有更改的情况下,project报告了错误


在我的例子中,在
菜单->构建->清洁解决方案
项目无误运行后。

将Windows 10显示语言从英语更改为德语(该应用程序最初是在德语系统上开发的)为我修复了它。

您能详细说明“此错误”吗@BalamBalam-我添加了一个屏幕截图和堆栈跟踪。我也一直收到错误。我对此感到厌倦。不知道你是否找到了修复方法…还没有,我只是做了一个重建来解决这个问题。