Caliburn.Micro does not have a "Bootstrapper" in the namespace in App.xaml

EDITOR: It seems I finally got it to work. I asked the author of this post, which I spoke about earlier, and he said that this is a known problem. He also gave mi a workaround (in the comment below the post), so I view this issue as closed. But thank you all for your time on my problems :)


I am trying to learn MVVM with Caliburn Micro framework, but I have problems from the very beginning. I follow this tutorial and I got this code in App.xaml:

<Application
x:Class="Caliburn.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:caliburnMicro="clr-namespace:Caliburn">
<!--Application Resources-->
    <Application.Resources>
        <caliburnMicro:Bootstrapper x:Key="bootstrapper" />
    </Application.Resources>
</Application>

But I have an error:

The name "Bootstrapper" does not exist in the namespace "clr-namespace: Caliburn".

I got Caliburn Micro 1.5.2 from the NuGet repository. Any ideas appreciated ...

My bootstrapper:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Caliburn.Micro;

namespace Caliburn
{
public class Bootstrapper : PhoneBootstrapper
{
    PhoneContainer container;

    protected override void Configure()
    {
        container = new PhoneContainer();

        container.RegisterPhoneServices(RootFrame);
        //container.PerRequest<MainPageViewModel>();

        AddCustomConventions();
    }

    static void AddCustomConventions()
    {
        //ellided  
    }

    protected override object GetInstance(Type service, string key)
    {
        return container.GetInstance(service, key);
    }

    protected override IEnumerable<object> GetAllInstances(Type service)
    {
        return container.GetAllInstances(service);
    }

    protected override void BuildUp(object instance)
    {
        container.BuildUp(instance);
    }
}
}
0
4

Bootstrapper, Caliburn.Micro. .

- Caliburn.Micro.Start NuGet bootstrapper. documentation , App.xaml.

+4

, , caliburn, , -, . , , :

<Application
x:Class="Caliburn.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:caliburnMicro="clr-namespace:Caliburn">
<!--Application Resources-->
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary>
                    <local:Bootstrapper x:Key="bootstrapper" />
                </ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>
+1

, . OnStart Bootstrapper , .

protected override void OnStartup(object sender, StartupEventArgs e)
{
    DisplayRootViewFor<ViewModels.ShellVM>();
}
-1

Source: https://habr.com/ru/post/1527772/


All Articles