I've tried to update my application from Prism v4.0 to Prism v6.1.0 and run package manager: PM> Install-Package Prism.Core
and PM has installed such packages:
The next step I've tried to create bootstrapper:
public class Bootstrapper : UnityBootstrapper
{
protected override DependencyObject CreateShell()
{
return Container.Resolve<Shell>();
}
protected override void InitializeShell()
{
base.InitializeShell();
App.Current.MainWindow = (Window)Shell;
App.Current.MainWindow.Show();
}
protected override void ConfigureContainer()
{
base.ConfigureContainer();
Container.RegisterType<IShellViewModel, ShellViewModel>();
}
protected override RegionAdapterMappings ConfigureRegionAdapterMappings()
{
RegionAdapterMappings mappings = base.ConfigureRegionAdapterMappings();
mappings.RegisterMapping(typeof(StackPanel), Container.Resolve<StackPanelRegionAdapter>());
return mappings;
}
protected override IModuleCatalog CreateModuleCatalog()
{
ModuleCatalog catalog = new ModuleCatalog();
catalog.AddModule(typeof(ModuleBModule));
return catalog;
}
}
and I've tried to resolve the UnityBootstrapper
. However, there is no such a class at Prism 6.1.0.
So I've tried to install by Nuget:
Prism.UnityExtesions
However NuGet says: This package is no longer supported. Please use the new Prism.Unity package
.
There is a bootstrapper class with Prism 5.0. But Prism 5.0 is not supported now. For example, in this example HelloWorld from code.msdn.
So to my mind come the question: How to create bootstrapper at Prism 6.1.0?
As mentioned in the comments by @toumir, first uninstall all Microsoft.Practices.*
packages (check your packages.config to be sure they're all uninstalled).
Since you're trying to use Unity with Prism 6, the only package you have to install is Prism.Unity. This will automatically bring in all other packages needed:
It's a good practice to only add the most specific package, as with the new project files (.NET Core, ASP.NET 5, Win10 UWP) the old packages.config file is replaced by a project.json file and NuGet v3 will take care of better dependency resolving. As of today it's not used yet for WPF, but that shouldn't keep you from doing it "right".
For new documentation and samples on Prism 6, please head over to the Prism GitHub repositories.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With