The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,858 other subscribers

Visual Studio 2005/2008 WPF bug: App.xaml not found messages

Posted by jpluimers on 2010/06/17

When you do some maintenance on old projects, you sometimes bump into things you have completely forgotten about.

This time it is in Visual Studio 2005, with a WPF app, and messages about App.xml.

Since there are few threads covering this problem, so I’m not sure how many people bump into this.
I know that the problem does not limit itself to C#;  I have seen people in VB.NET and Delphi.net bump into this as well.
This problem is not limited to Visual Studio 2005, some people also have it in Visual Studio 2010.
Some people also have it with other objects than App.xaml (like Windows1.xaml, etc).

If you get this error, the solution is simple:

  1. perform a “Clean Solution”,
  2. then run your app again.

This trick has worked for me every time I bumped into it.These are the error messages:

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 MyNamespace.App.InitializeComponent() in C:\Path\Solution\Application\App.xaml:line 1
       at MyNamespace.BootStrap.Main() in C:\Path\Solution\Application\BootStrap.cs:line 22
---------------------------
Microsoft Visual Studio
---------------------------
Entering break mode failed for the following reason: Source file 'C:\Path\Solution\Application\App.xaml' does not belong to the project being debugged.

Usually, this condition occurs when the project was not rebuilt prior to starting the debugging session, when the assembly file for the project is out of date, or when the project source files were moved to a different disk location between the time the project was built and the debugging session was started.

Edit and Continue will be disabled for this debugging session.
---------------------------
OK
---------------------------

2 Responses to “Visual Studio 2005/2008 WPF bug: App.xaml not found messages”

  1. sugeng's avatar

    sugeng said

    clean solution what is that ??

Leave a reply to sugeng Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.