2009-12-03 70 views
0

我正尝试通过自定义脚本(如下)使用msbuild构建一个简单的WPF应用程序。该项目通过Visual Studio构建和执行,但如果使用msbuild脚本,它将成功构建并生成可执行文件,但在启动时立即崩溃(使用“WPFApplication has stopped working”错误消息)。通过msbuild使用XAML构建WPF应用程序

有没有人遇到过这种情况,或者有什么建议可以尝试?

谢谢!

构建脚本

<PropertyGroup> 
     <AssemblyName>WPFApplication</AssemblyName> 
     <OutputType>winexe</OutputType> 
    </PropertyGroup> 

    <ItemGroup> 
     <Reference Include="System" /> 
     <Reference Include="WindowsBase" /> 
     <Reference Include="PresentationCore" /> 
     <Reference Include="PresentationFramework" /> 
    </ItemGroup> 

    <ItemGroup> 
     <ApplicationDefinition Include="WpfBuild\WpfBuild\App.xaml" /> 
     <Compile Include="WpfBuild\WpfBuild\App.xaml.cs" /> 
     <Page Include="WpfBuild\WpfBuild\Window1.xaml" /> 
     <Compile Include="WpfBuild\WpfBuild\Window1.xaml.cs" /> 
    </ItemGroup> 

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

</Project> 

回答