2012年12月20日木曜日

Create a simplest WPF application.

First, you need a xaml file to specify the application.
<!--  app.xaml  -->
<Application
 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 StartupUri="win.xaml"/>

Second, you need to specify the window.
<!-- win.xaml -->
<Window
 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 Title="Simplest XAML"
 Width="320"
 Height="230">
 Hello!
</Window>

Finally, a .proj file to tell the compile how to do everything.
<!-- hello.proj -->
<Project
 xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
 DefaultTarget="Build">
 <PropertyGroup>
  <AssemblyName>SimplestWPF</AssemblyName>
  <OutputType>winexe</OutputType>
  <OutputPath>.\</OutputPath>
 </PropertyGroup>
 <ItemGroup>
  <ApplicationDefinition Include="app.xaml" />
  <Page Include="win.xaml" />

  <Reference Include="System" />
  <Reference Include="WindowsBase" />
  <Reference Include="PresentationCore" />
  <Reference Include="PresentationFramework" />
 </ItemGroup>
 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 <Import Project="$(MSBuildToolsPath)\Microsoft.WinFX.targets" />
</Project>

Navigate VS command console to the directory which holds these 3 files,
enter "msbuild".

0 件のコメント:

コメントを投稿