Typescript compilation issues in appharbor

I am trying to run typescript to run on appharbor using the typescript html5 project template.

I copied the typescript destination folder from the MSBuild folder and the SDK folder to my project, but everything works, however, when I click appharbor I get the error below.

I also took the liberty of correcting the typescript goal from searching for the SDK in the Microsoft SDk folder, instead of looking at the "vendors" folder.

0.9.1.1 compiler version 0.9.1.1

The error message I receive is as follows:

 error MSB6006: "tsc.exe" exited with code 1 

I get the following output from the typescript task in my assembly.

 CompileTypeScript: D:\temp\bn4vn5tf.fls\input\test\..\Vendors\TypeScript\tsc.exe --removeComments --declaration --module AMD --out ".\js\all.js" --target ES5 "app.ts" 

Below you can see the error.

 CompileTypeScript: Cannot initialize ActiveScript D:\temp\bn4vn5tf.fls\input\vendors\TypeScript\Microsoft.TypeScript.targets(72,5): error MSB6006: "tsc.exe" exited with code 1. [D:\temp\bn4vn5tf.fls\input\test\test.csproj] 

I created a public framework with full build output.

https://gist.github.com/dmportella/6470465

I also created an entity for the typescript target so that you can see the changes I made to it.

https://gist.github.com/anonymous/6470504

thanks and go

UPDATE

As Ryan said, I changed from tsc.exe to running the tsc.js file using nodejs, I had to add typescript SDKs and Nodejs binaries to my GIT repository (which is good practice anyway) and finally add the required exec task to the file typescript project.

List of things you need to do.

  • Add Nodejs to your repository
  • Add typescript Sdk to your repository
  • Remove imports for typescript purposes from your project
  • Add exec task to execute tsc.js using nodejs

See below MSBuild xml which I use in my project.

  <!-- Target ignored as it will not work on appharbor --> <!--<Import Project="$(VSToolsPath)\TypeScript\Microsoft.TypeScript.targets" />--> <Target Name="BuildTypeScript" BeforeTargets="build"> <Message Importance="high" Text="Running TypeScript Compiler using NodeJs" /> <Message Importance="high" Text="..\Vendors\nodejs\node.exe ..\Vendors\TypeScript\tsc.js --removeComments --declaration --module AMD --out $(TypeScriptOutFile) --target ES5 @(TypeScriptCompile)"/> <Exec Command="..\Vendors\nodejs\node.exe ..\Vendors\TypeScript\tsc.js --removeComments --declaration --module AMD --out $(TypeScriptOutFile) --target ES5 @(TypeScriptCompile)"/> </Target> 
+4
source share
2 answers

TypeScript 0.9.1.1 requires the installation of IE10 or later. If this is not an option for you, you can run tsc.js via node.

+5
source

The solution dmportella included in his answer also helped me, but the goal of MSBuild didn't want to work, just copying and changing paths.

Here is the goal that worked for me (please drop the path changes, this is not an important part):

 <Target Name="BuildTypeScript" BeforeTargets="build" Outputs="%(TypeScriptCompile.Identity)"> <Message Importance="high" Text="Running TypeScript Compiler using NodeJs" /> <Message Importance="high" Text="..\..\Tools\nodejs\node.exe ..\..\Tools\typescript\sdk\tsc.js --removeComments --declaration --module AMD --target ES5 %(TypeScriptCompile.Identity)"/> <Exec Command="..\..\Tools\nodejs\node.exe ..\..\Tools\typescript\sdk\tsc.js --removeComments --declaration --module AMD --target ES5 %(TypeScriptCompile.Identity)"/> </Target> 
+5
source

Source: https://habr.com/ru/post/1501014/


All Articles