Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error MSB4064: The "ComputeInputAndOutputOnly" parameter is not supported by the "VsTsc" task

After upgrading to Typescript 2.7.2 (from 2.4) I get the following error on the build server:

packages\Microsoft.TypeScript.MSBuild.2.7.2\tools\Microsoft.TypeScript.targets(378,7): Error MSB4064: The "ComputeInputAndOutputOnly" parameter is not supported by the "VsTsc" task. Verify the parameter exists on the task, and it is a settable public instance property.

The project brings in the Microsoft.TypeScript.MSBuild as a package dependency. Packages.config includes:

  <package id="Microsoft.TypeScript.Compiler" version="2.7.2" targetFramework="net462" developmentDependency="true" />
  <package id="Microsoft.TypeScript.MSBuild" version="2.7.2" targetFramework="net462" developmentDependency="true" />

Using the packaged compiler is preferable to installing Typescript on the server (as you would on a local machine) because we have a lot of build servers and keeping them up to date whenever a project needs a newer version of typescript would be impractical.

Digging into the Microsoft.TypeScript.targets in the packages folder I can see the offending parameter is used:

<Target Name="CompileTypeScriptWithTSConfig"
    Condition="'$(BuildingProject)' != 'false' AND '@(ConfigFiles)' != '' AND '$(DesignTimeBuild)' != 'true'"
    DependsOnTargets="$(CompileTypeScriptDependsOn)"
    BeforeTargets="$(CompileTypeScriptBeforeTargets)"
    AfterTargets="$(CompileTypeScriptAfterTargets)"
    Inputs="@(TypeScriptInputFiles)" Outputs="@(GeneratedJavascript)">
    <!--For some reason, ItemGroup operations are occurring even when the target is skipped-->
    <!--So we use the CompileRan property to ensure the ItemGroup operations only run when it isn't skipped-->
    <CreateProperty Value="true">
      <Output TaskParameter="ValueSetByTask" PropertyName="CompileRan" />
    </CreateProperty>
    <ItemGroup>
      <emittedFiles Remove="@(emittedFiles)" Condition="'$(CompileRan)' == 'true'" />
      <GeneratedJavascript Remove="@(GeneratedJavascript)" Condition="'$(CompileRan)' == 'true'" />
    </ItemGroup>
    <VsTsc
      ToolPath="$(TscToolPath)"
      ToolExe="$(TscToolExe)"
      IsFileSystemCaseSensitive="$(IsFileSystemCaseSensitive)"
      TSJavaScriptFile="$(TSJavaScriptFile)"
      PreferredUILang="$(PreferredUILang)"
      TSConfigFile="%(TSConfigFilesWithOutputLogs.Identity)"
      YieldDuringToolExecution="$(TscYieldDuringToolExecution)"
      ProjectDir="$(TypeScriptProjectDir)"
      ToolsVersion="$(TypeScriptEffectiveToolsVersion)"
      TypeScriptCompileBlocked="$(TypeScriptCompileBlocked)"
      ComputeInputAndOutputOnly="false"
      OutputLogFile="%(TSConfigFilesWithOutputLogs.OutputLog)"
      OutputLogDirectory="$(TSCompilerOutputLogDirectory)">

      <Output TaskParameter="GeneratedJavascript" ItemName="emittedFiles" />
    </VsTsc>
    <ItemGroup>
      <GeneratedJavascript Include="@(emittedFiles)" KeepDuplicates="false" Condition="'$(CompileRan)' == 'true'" />
    </ItemGroup>
  </Target>

Could this be due to an old version of MSBuild on the server? The server downloads the Microsoft.TypeScript.MSBuild package as part of the build process, so there's no way I can modify the target file within the package. Any help or work arounds would be much appreciated. Thanks!

like image 783
huwjeffries Avatar asked Feb 28 '18 11:02

huwjeffries


1 Answers

I had the same issue and needed to beat my project timeline, so i commented these line of code for now, will look for more pleasant solution

ComputeInputAndOutputOnly="true"
OutputLogDirectory="$(TSCompilerOutputLogDirectory)">

<Output TaskParameter="FullPathsToFiles" ItemName="TypeScriptInputFiles" />

Hopefully there will be a better solution

like image 166
Bosco Avatar answered Oct 13 '22 01:10

Bosco