How to: Manually Create a Start Page

If you cannot create a custom Start Page by using the Start Page project template, as described in Start Pages, you can manually create one by following the steps in this document.

Creating a Blank Start Page

First, make a blank Start Page by creating a .xaml file that has a tag structure that Visual Studio will recognize. Then, add markup and code-behind to produce the appearance and functionality you want.

To create a blank Start Page

  1. On the File menu, click New and then click Project.

  2. In the New Project dialog box, under Installed Templates, click Visual C# or Visual Basic, depending on the language you want to use, and then click Windows. In the middle pane, click WPF User Control Library.

  3. Name the project, and then click OK.

    Visual Studio creates the project and opens the .xaml file.

  4. In Solution Explorer, add references to Microsoft.VisualStudio.Shell.StartPage and 0.

    This step is not required, but it provides IntelliSense support for calling Visual Studio commands.

  5. In the editor, change the top-level UserControl element to a Grid element without removing any of the namespace declarations.

  6. Remove the x:Class declaration from the top-level Grid element.

    This makes the XAML content compatible with the Visual Studio tool window that hosts the Start Page.

  7. Add the following namespace declarations to the top-level Grid element.

    xmlns:sp="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.StartPage"
    xmlns:vs="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.10.0"
    xmlns:vsfx="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.10.0"
    

    These namespaces let you access Visual Studio commands, controls, and user interface (UI) settings from markup. For more information, see Adding Visual Studio Commands to a Start Page.

  8. Add controls to the empty Grid element to fill in your custom Start Page. For information about how to add functionality that is specific to Visual Studio, see Adding Visual Studio Commands to a Start Page.

Testing and Applying the Custom Start Page

Always test new Start Pages in the experimental instance of Visual Studio. That way, if your Start Page causes a crash, it will be limited to the experimental instance and you can fix the errors in the primary instance. Do not set the primary instance to run the custom Start Page until you verify that it does not crash.

To test a manually created custom Start Page

  1. In Windows Explorer, copy your .xaml file, and any supporting text files or markup files that it depends on, and then paste them in ..\My Documents folder\Visual Studio 10\StartPages\.

  2. If your Start Page references any controls or types in other assemblies, copy the assemblies and then paste them in ..\Visual Studio installation folder\Common7\IDE\PrivateAssemblies\.

  3. At a Visual Studio command prompt, type Devenv /rootsuffix to open an experimental instance of Visual Studio.

  4. In the experimental instance, on the Tools menu, click Options.

  5. In the Options dialog box, under Environment, select Startup. Then, on the Customize Start Page list, select your .xaml file, and click OK.

  6. On the View menu, click Start Page.

    Your custom Start Page should be displayed. If you want to change any files, you must close the experimental instance, make the changes, copy and paste the changed files, and then re-open the experimental instance to view the changes.

To apply the custom Start Page in the primary instance of Visual Studio

  • After you have tested your Start Page and found it to be stable, use the Customize Start Page option in the Options dialog box to select it as the Start Page in the primary instance of Visual Studio

Example

The following example shows the markup in the .xaml file for a blank Start Page. Any custom content would go in the inner Grid element.

<Grid        xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="https://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="https://schemas.microsoft.com/expression/blend/2008" 
             xmlns:sp="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.StartPage"
             xmlns:vs="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.10.0"
             xmlns:vsfx="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.10.0"
         mc:Ignorable="d" 
             d:DesignHeight="600" d:DesignWidth="800">
    <Grid>
        <!--Add content here.-->
    </Grid>
</Grid>

See Also

Tasks

Start Pages

Concepts

Deploying Custom Start Pages

Start Page Best Practices