在msbuild项目中的CompileTypeScript目标上键入ScriptOutFile

时间:2015-01-21 01:41:08

标签: msbuild typescript

我想在build上有一个来自typescript来源的组合js文件。我的* .csproj文件:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props" />
  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" />

  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <ProjectGuid>{83A2324A-201F-4CE8-A57B-16770214E3B2}</ProjectGuid>
    <TypeScriptToolsVersion>1.4</TypeScriptToolsVersion>
    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">12.0</VisualStudioVersion>
    <TypeScriptCompileOnSaveEnabled>False</TypeScriptCompileOnSaveEnabled>
    <TypeScriptOutFile>..\bin\app.js</TypeScriptOutFile>
    <TypeScriptSourceMap>true</TypeScriptSourceMap>
  </PropertyGroup>

  <ItemGroup>
    <TypeScriptCompile Include="src\TypeScriptCompilerPlugin.ts" />
  </ItemGroup>

  <Target Name="Build" DependsOnTargets="CompileTypeScript">
  </Target>

</Project>

问题:在构建VS生成文件src \ TypeScriptCompilerPlugin.js,而不是.. \ bin \ app.js ...

1 个答案:

答案 0 :(得分:3)

解决方案:导入 Microsoft.TypeScript.Default.props 必须位于文件的顶部,但导入 Microsoft.TypeScript.targets 必须位于底部。< / p>