我正在尝试使用打字稿html5项目模板来使打字稿在appharbor上运行。
我已将MSBuild文件夹和SDK文件夹中的Typescript目标文件夹复制到我的项目中,但本地一切正常,但是当我推送到appharbor时,出现下面的错误。
我也冒昧地修改了typescript目标,从查找Microsoft SDk文件夹中的SDK来查看我的“vendors”文件夹。
打字稿编译器的版本是0.9.1.1
错误消息我得到以下一个:
error MSB6006: "tsc.exe" exited with code 1我在构建中获得以下typescript任务输出。
CompileTypeScript: D:\temp\bn4vn5tf.fls\input\test\..\Vendors\TypeScript\tsc.exe --removeComments --declaration --module AMD --out ".\js\all.js" --target ES5 "app.ts"在下面你可以看到错误。
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]我创建了一个带有完整构建输出的公共要点。
https://gist.github.com/dmportella/6470465
我还为打字稿目标创建了一个要点,以便您可以看到我对其进行的更改。
https://gist.github.com/anonymous/6470504
谢谢和进步
UPDATE
正如Ryan建议我已经从tsc.exe更改为使用nodejs运行tsc.js文件,我必须将Typescript SDK和Nodejs二进制文件添加到我的GIT存储库(无论如何这都是很好的做法),并最终将所需的exec任务添加到打字稿项目文件。
您需要做的事情列表。
将Nodejs添加到您的存储库 将Typescript Sdk添加到您的存储库 从项目中删除针对typescript目标的导入 添加exec任务以使用nodejs执行tsc.js看看下面我正在使用我的项目的MSBuild XML。
<!-- 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>I am trying to get typescript to run on appharbor using the typescript html5 project template.
I have copied the Typescript target folder from the MSBuild folder and the SDK folder into my project, locally everything works however when I push to appharbor I get the error detailed below.
I also took the liberty to amend the typescript target from looking for the SDK in the Microsoft SDk folder to look at my "vendors" folder instead.
The typescript compiler's version is 0.9.1.1
The error message I get the following one:
error MSB6006: "tsc.exe" exited with code 1I get the following typescript task output on my build.
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 have created a public gist with the full build output.
https://gist.github.com/dmportella/6470465
I also created a gist for the typescript target so you can see the changes I made to it.
https://gist.github.com/anonymous/6470504
Thx and advance
UPDATE
As Ryan suggested I have changed from the tsc.exe to running the tsc.js file with nodejs I had to add the Typescript SDK and the Nodejs binaries to my GIT repository (which is good practice anyway) and finally add the required exec task to the typescript project file.
List of things you need to do.
Add Nodejs to your repository Add Typescript Sdk to your repository Remove the import for typescript targets from your project Add the exec task to execute tsc.js using nodejsSee below the MSBuild xml I am using on 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>最满意答案
TypeScript 0.9.1.1要求安装IE10或更高版本。 如果这不适合您,您可以通过节点运行tsc.js。
TypeScript 0.9.1.1 requires IE10 or later to be installed. If that's not an option for you, you can run tsc.js through node instead.
更多推荐
发布评论