Nuget Package Installation

NuGet is a Visual Studio 2010 extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects that use the .NET Framework. Caliburn.Micro is proud to support the NuGet Package Manager.

Installing the Package

With NuGet 1.2 or later installed, open the Package Manager Console and type:

CaliburnNuGet.png

After Installation

1. Clean out your App.xaml.cs file. It should look like this:


namespace YourNamespace
{
    using System.Windows;

    public partial class App : Application
    {
        public App()
        {
            InitializeComponent();
        }
    }
}

2. Add the AppBoostrapper to your App.xaml's Resources section.

Silverlight

<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:YourNamespace"
             x:Class="YourNamespace.App">
    <Application.Resources>
        <local:AppBootstrapper x:Key="bootstrapper" />
    </Application.Resources>
</Application>
Note: You no longer need the default MainPage.xaml.

WPF

<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:YourNamespace"
             x:Class="YourNamespace.App">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary>
                    <local:AppBootstrapper x:Key="bootstrapper" />
                </ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>
Note: Make sure to remove the StartupUri value. Caliburn.Micro will be handling the main window creation for you. As a result, you no longer need the MainWindow.xaml either.

Windows Phone 7

<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:YourNamespace"
             x:Class="YourNamespace.App">
    <Application.Resources>
        <local:AppBootstrapper x:Key="bootstrapper" />
    </Application.Resources>
</Application>

Note: If you move your MainPage.xaml into a Views folder, don't forget to update your WMAppManfiest.xml to point to the new URI
<Tasks>
      <DefaultTask Name="_default" NavigationPage="/Views/MainPage.xaml" />
</Tasks>

3. Run your application.

4. Review the Cheat Sheet.

Last edited Apr 11, 2012 at 2:45 PM by mhidinger, version 22

Comments

nbarnwell Feb 20 at 11:45 AM 
Is the package name still relevant? I'm fairly sure one needs to install Caliburn.Micro.Start these days?