I started with sample 1 of the Prism samples on GitHub and immediately I get a warning that using a UnityBootstrapper is deprecated. So I sought to upgrade it to the current mechanism.
First step is to replace the base class of your application from Application to PrismApplication in App.xaml. It should now look like this;
<unity:PrismApplication x:Class="BootstrapperShell.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:BootstrapperShell"
xmlns:unity="http://prismlibrary.com/">
<Application.Resources>
</Application.Resources>
</unity:PrismApplication>
Then in App.xaml.cs, remove the reference to Application and implement the abstract methods of PrismApplication. Copy across the contents of InitializeShell in Bootstrapper.cs into the CreateShell() method. The final result should look like this;
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App
{
protected override Window CreateShell()
{
return Container.Resolve<MainWindow>();
}
protected override void RegisterTypes(IContainerRegistry containerRegistry)
{
}
}
I also added some markup to MainWindow.xaml in order to ensure that it was resolving correctly;
<Window x:Class="BootstrapperShell.Views.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Shell" Height="350" Width="525">
<Grid>
<TextBlock HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="24">Hello</TextBlock>
</Grid>
</Window>
Everything should work as it did before.