This documentation is archived and is not being maintained.

How to: Create a Sample Project File for a Windows Presentation Foundation Custom Control Library

This example project file is for a Windows Presentation Foundation (WPF) custom control library, with a single user control, WPFUserControl. Key configuration details include:

  • OutputType. Set to library.

  • WPFUserControl.xaml. A XAML file that is declared as a Page element.

  • WPFUserControl.xaml.cs. A code-behind file that is declared as a Compile element.

You can reuse or modify this project file to suit your needs, as long as the files you reference are in the location you're referencing them from. Alternatively, you can have a project file for a custom control automatically generated for you by using the Custom Control Library (WPF) project template in Microsoft Visual Studio 2005.

This project file is for a C# project and consequently includes the Microsoft.CSharp.targets Import element. Microsoft Visual Studio 2005 gives C# project files a .csproj extension. A Microsoft Visual Basic .NET created in Microsoft Visual Studio 2005 would typically have the .vbproj extension, and would include the Microsoft.VisualBasic.targets Import element.

<Project DefaultTargets="Build" xmlns="">


<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>

<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>







<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">







<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">







<Reference Include="System" />

<Reference Include="WindowsBase" />

<Reference Include="PresentationCore" />

<Reference Include="PresentationFramework" />



<Page Include="WPFUserControl.xaml" />

<Compile Include="WPFUserControl.xaml.cs" />



<Compile Include="Properties\AssemblyInfo.cs" />

<AppDesigner Include="Properties\" />


<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />

<Import Project="$(MSBuildBinPath)\Microsoft.WinFX.targets" />