MrKlein
MrKlein

Reputation: 11

tsc compile code 1 error after upgrading typescript 0.8.1 project to 0.8.3.1

I upgraded a typescript project version 0.8.1 to 0.8.3.1 I did this by installing Typescript 0.8.3.1, creating a new project and copying all source files, publish settings and project files into this project. I manually editted the csproj file to be consistent with the 0.8.3 project file.

This is the error I encounter:

The command "tsc --comments --sourcemap --target ES5 " exited with code 1

However, from the commandline with the exact same command :

tsc --comments --sourcemap --target ES5

Everything seems to work fine. The project is a TFS project, so I already tried removing all readonly attributes on all files. Cleaning and rebuilding the project. Closing all windows. Restarting Visual studio etc.. The 'strange' thing is that the typescript files will compile when saved, but not on a complete rebuild.

FIX, so it seems:

It seemed I missed a new property in the itemgroup of the .csproj file

<ItemGroup>
    <TypeScriptCompile Include="FirstTypescriptFile.ts" />
    <Content Include="com\interfaces\IContext.js">

I added the "TypeScriptCompile Include="FirstTypescriptFile.ts" and now everything works as expected.

Upvotes: 1

Views: 2191

Answers (1)

Fenton
Fenton

Reputation: 251262

The most likely change is that the path to tsc.exe changed. In fact, in order to prevent all the issues with the constantly changing path, the TypeScript team decided to put it one level up so we didn't have to keep editing the path.

So in your project file, check for the full path and adjust it, for example here:

<Target Name="BeforeBuild">
    <Exec Command="&quot;$(PROGRAMFILES)\Microsoft SDKs\TypeScript\tsc&quot; --declaration @(TypeScriptCompile ->'&quot;%(fullpath)&quot;', ' ')" IgnoreExitCode="true" />
</Target>

In older versions, the path was ...\TypeScript\0.8.1\tsc.

Upvotes: 3

Related Questions