I need to customise the `Main()` method in my WPF application, so I have turned off the auto-generation of the main, by changing the Build Action of my `App.xaml` to 'Page' (instead of 'ApplicationDefinition'). However, I also need to use a `ResourceDictionary`, and if the `App.xaml` isn't marked as 'ApplicationDefinition', none of the resources get imported (I tried this, see [here](https://stackoverflow.com/questions/19982330/why-are-style-resources-from-a-resourcedictionary-not-applied)).

I need a custom `Main()` method because the application is required to be a singleton, to the main simply reads:

```
[STAThread]
public static void Main()
{
    MainApplication app = MainApplication.Instance;
    app.Run();
}

```

No how do I automatically import all resources **and** define my own main at the same time?

One solution is to import them programatically, e.g. like this:

```
ResourceDictionary dict = new ResourceDictionary();
dict.Source = new Uri("/MyProject;component/MyResourceDictionary.xaml", UriKind.Relative);
Application.Current.Resources.MergedDictionaries.Add(dict);

```

This solution is not acceptable, though, as I want to be able to give my application to a designer who uses Blend and may know *nothing* about the background of the programme. So he would not be permitted to create new resource files, which is not ideal. Any better suggestions?