2015-03-03 89 views

回答

14

打開Microsoft.TypeScript.targets文件位於C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\TypeScript下和前</Project>標籤添加以下

<Target Name="PreComputeCompileTypeScript"> 
<VsTsc 
    ToolPath="$(TscToolPath)" 
    ToolExe="$(TscToolExe)" 
    Configurations="$(TypeScriptBuildConfigurations)" 
    FullPathsToFiles="@(TypeScriptCompile)" 
    YieldDuringToolExecution="$(TscYieldDuringToolExecution)" 
    OutFile="$(TypeScriptOutFile)" 
    OutDir="$(TypeScriptOutDir)" 
    ProjectDir="$(ProjectDir)">  
    <Output TaskParameter="GeneratedJavascript" ItemName="GeneratedJavascript" /> 
    </VsTsc> 
    <AssignTargetPath Files="@(GeneratedJavascript)" RootFolder="$(MSBuildProjectDirectory)"> 
    <Output TaskParameter="AssignedFiles" ItemName="GeneratedJavascriptWithTargetPath" /> 
</AssignTargetPath> 
<ItemGroup> 
    <FilesForPackagingFromProject Include="@(GeneratedJavascriptWithTargetPath->'%(Identity)')"/> 
    <ContentWithTargetPath Include="@(GeneratedJavascriptWithTargetPath->'%(Identity)')"/> 
    <Content Include="@(GeneratedJavascript->'%(Identity)')"/> 
</ItemGroup> 
</Target> 
1

只是有類似的問題,與Visual Studio 2015年,該路徑是這樣的:

C:\ Program Files文件(x86)\ MSBuild \ Microsoft \ VisualStudio \ v14.0 \ ApacheCordovaTools \ vs-mda-targets \ Microsoft.TypeScript.MDA.targets

而這足以插入另一個虛擬的目標:

<!-- Overriding targets which when absent cause warnings from common targets --> 
    ... 
    <Target Name="PreComputeCompileTypeScript" /> 

</Project> 

是因爲目標「CompileTypeScript」依賴「PreComputeCompileTypeScript」。

+0

這個建議對我很有幫助,因爲我可以更改自己的項目文件而不是已安裝的文件;這使我的構建也能在VSTS上取得成功。 – Evan 2017-05-10 17:03:26

相關問題