IOException未处理 - 无法定位资源app.xaml

5
在我的WPF项目中,当我打开解决方案并在调试时启动它时,出现了这个错误。如果我重新构建解决方案并再次启动它,错误就消失了。
我通过删除App.xaml中的StartUpUri来实现应用程序的命令行支持,使用以下方法: WPF命令行 我该如何摆脱这个烦人的错误?
使用VS 2010 .net 4.0

enter image description here

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: 

你能详细说明一下“这个错误”吗? - paparazzo
@BalamBalam - 我已经添加了屏幕截图和堆栈跟踪。 - Jon Raynor
我也一直遇到这个错误,感到非常烦恼。不知道你是否找到了解决方法... - SpoiledTechie.com
还没有,我现在只是重新构建一下来解决这个问题。 - Jon Raynor
3个回答

2

我遇到了与问题(VS2010)中指定的情况相同的情况。
昨天,项目没有任何问题。今天,在没有更改代码的情况下,项目报告错误。

在我的情况下,经过菜单 -> 构建 -> 清理解决方案后,项目可以无错误运行。


1

0

将 Windows 10 的显示语言从英语更改为德语(该应用最初是在德语系统上开发的)对我有所帮助,问题得到了解决。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接