Basically I'm having the same issue as this (unanswered) question: IOException was unhandled - Cannot locate resource app.xaml
When I open my project in Visual Studio 2010 and start debugging, I get "IOException was unhandled: Cannot locate resource app.xaml". Rebuilding the solution DOES NOT work, I have to somehow modify my app.xaml file (adding an empty line, for example) in order to run my project successfully.
Additional details:
- My solution consists of two projects: My main (WPF) application and a test project.
- I have read about issues if the solution was converted from Visual Studio 2005. This is not my case. My project was originally created with Visual Studio 2010. Maybe (I don't remind exactly) it was sometime targetted at .Net Framework 3.5 or .Net Framework 4.0 Client Profile, but it currently is configured to work with .Net Framework 4.0
- Both projects have different names, if that matters. The first is called MyApplicationName (assembly name and default namespace) and the second MyApplicationName.Test (assembly name and default namespace too)
- Most classes in my main project are internal (including the View classes), but my App class is public
- The main project exposes its internal components to the test project (using
[assembly: InternalsVisibleTo("MyOtherProject")]
) - I'm using MVVM (with MVVM Light), but I'm not using a ViewModel 'resolver'/container/bootstrapper/MEF or related things. I just map my ViewModels to their respective views using DataTemplates and create my ViewModels manually (if that matters).
My App.xaml includes other three xaml resource files. I include my App.xaml here:
<Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="Resources/StyleDictionary.xaml" /> <ResourceDictionary Source="Resources/CommonResources.xaml" /> <ResourceDictionary Source="Resources/ViewModelMappings.xaml" /> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources>
I override the OnStartup method from my App class to manually handle the startup logic, if that matters. I also wrote a static constructor there to initialize the DispatcherHelper from MVVM Light:
public partial class App : Application { static App() { GalaSoft.MvvmLight.Threading.DispatcherHelper.Initialize(); } ... }