IOException was unhandled - Cannot locate resource app.xaml
In one of my WPF projects I get this error when I open the solution and start it up when debugging it. If I rebuild the solution and start it again, the error goes away.
I have implemented command line support for application by removing the StartUpUri in App.xaml using this:
WPF Command Line
How do I get rid of this annoying error?
Using VS 2010 .net 4.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._n开发者_开发问答ExecuteAssembly(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:
I have seen that error before, when porting from VS 2005 to 2008. Never seen in 2010. For some reason, the build settings for app.xaml were lost. So you can check the the properties of app.xaml. The correct settings are shown in the image attached.
On the other hand, if you are working with MVVC, it can be a different cause, like explained here: http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/39d7a4dd-9034-4ae8-843c-ccd4940ba51c/
I have the same situation as specified in question (VS2010).
Yesterday, project worked without problems. Today, with no changes to the code, project reported error.
In my case after Menu -> Build -> Clean Solution
project run without error.
Changing Windows 10 display language from English to German (the app was originally developed on a German system) fixed it for me.
精彩评论