开发者

Building a WPF Application with XAML through msbuild

I am attempting to build a simple WPF Application using msbuild via a custom script (below). The project builds and executes fine through Visual Studio, however if I use the msbuild script it builds successfully, and generates the executable, but crashes immediately on startup (with a "WPFApplication has stopped working" error message).

Has anyone experienced this before, or have any suggestions for things to try?

Thanks!

Build Script

    <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" />
     <Impor开发者_StackOverflow社区t Project="$(MSBuildBinPath)\Microsoft.WinFX.targets" />

</Project>


Edit the csproj file and put a line similar to this near the end, near to the line with "Microsoft.CSharp.targets" in it:

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

See http://msdn.microsoft.com/en-us/library/aa970678%28VS.85%29.aspx

I'm currently looking for answers to something similar. I found another SO link wpf-app-builds-in-vs2k8-but-not-on-command-line-w-msbuild

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜