IOException was unhandled - could not find app.xaml resource

In one of my WPF projects, I get this error when I open a solution and run it when debugging it. If I rebuild the solution and start it again, the error will disappear.

I implemented command line support for the application by removing StartUpUri in App.xaml using this:

WPF Command Line

How to get rid of this annoying mistake?

Using 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: 
+4
source share
2 answers

I saw this error before, when porting from VS 2005 to 2008. I have never seen it in 2010. For some reason, the build settings for app.xaml were lost. This way you can check the properties of app.xaml. The correct settings are shown in the attached image.

app.xaml properties

On the other hand, if you work with MVVC, this may be another reason, as described here: http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/39d7a4dd-9034-4ae8-843c- ccd4940ba51c /

+1
source

I have the same situation as indicated in the question (VS2010).
Yesterday the project worked without problems. Today, without any changes to the code, the error message about the project.

In my case, after Menu -> Build -> Clean Solution project starts without errors.

0
source

All Articles