次の方法で共有


方法 : Windows Presentation Foundation スタンドアロン ナビゲーション アプリケーションのサンプル プロジェクト ファイルを作成する

更新 : 2007 年 11 月

この例のプロジェクト ファイルは、Windows Presentation Foundation (WPF) のスタンドアロン ナビゲーション アプリケーションのためのものであり、アプリケーション定義、ページを自動的に開くように構成されている App、および Extensible Application Markup Language (XAML) と分離コードで定義されている HomePage が含まれます。HomePage は NavigationWindow で開かれます。主な構成の詳細は次のとおりです。

  • OutputType: winexe に設定します。

  • App.xaml: ApplicationDefinition 要素として構成するアプリケーション定義ファイル。

  • HomePage.xaml: Page 要素として宣言する XAML ファイル。

  • HomePage.xaml: Compile 要素として宣言する分離コード ファイル。

このプロジェクト ファイルは、必要に応じて再利用したり変更したりできます。ただし、参照するファイルは参照元の場所に存在する必要があります。もう 1 つの方法として、Microsoft Visual Studio 2005 で Windows アプリケーション (WPF) プロジェクト テンプレートを使用して、スタンドアロン ナビゲーション アプリケーション用のプロジェクト ファイルを自動的に生成し、既定の WindowPage に置き換えることもできます。

このプロジェクト ファイルは C# プロジェクト用であるため、Microsoft.CSharp.targetsImport 要素が含まれています。Microsoft Visual Studio 2005 では、C# プロジェクト ファイルに .csproj という拡張子が付けられます。Microsoft Visual Studio 2005 で作成された Microsoft Visual Basic .NET には、通常 .vbproj という拡張子が付けられ、Microsoft.VisualBasic.targetsImport 要素が含まれます。

使用例

<Project DefaultTargets="Build" xmlns="https://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <RootNamespace>WPFStandaloneNavigationApplication</RootNamespace>
    <AssemblyName>WPFStandaloneNavigationApplication</AssemblyName>
    <WarningLevel>4</WarningLevel>
    <OutputType>winexe</OutputType>
    <ApplicationVersion>1.0.0.*</ApplicationVersion>
    <BootstrapperEnabled>false</BootstrapperEnabled>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>.\bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugSymbols>false</DebugSymbols>
    <Optimize>true</Optimize>
    <OutputPath>.\bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="WindowsBase" />
    <Reference Include="PresentationCore" />
    <Reference Include="PresentationFramework" />
  </ItemGroup>
  <ItemGroup>
    <ApplicationDefinition Include="App.xaml" />
    <Page Include="HomePage.xaml" />
    <Compile Include="HomePage.xaml.cs" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="Properties\" />
  </ItemGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.WinFX.targets" />
</Project>