I currently have Visual Studio 2015 with Update 3 installed on my machine. Within my solution, I have an Angular 2 application written in TypeScript. This application was included in the solution by following Angular's "5 minute quickstart" guide: https://angular.io/guide/quickstart
The Angular application is still in its early stages of development, and all configuration files were taken directly from the guide without any modifications.
While the solution builds successfully on my local machine, it fails to build on the remote build server during a TFS check-in. The errors I encounter during the MSBuild step are all TypeScript related:
- Error TS2307: Build: Cannot find module '@angular/core'.
- Error TS1219: Build: Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning
- Error TS2315: Build: Type 'any' is not generic.
- Error TS1148: Build: Cannot compile modules unless the '--module' flag is provided
- Error TS2304: Build: Cannot find name 'it'.
These errors just point to various parts of the Angular 2 app, totaling 29 errors. Interestingly, each error in the build log references the .csproj file containing the Angular application.
It seems that the TypeScript files should be compiled based on the tsconfig.json file configuration, rather than the Visual Studio project properties. Despite modifying the TypeScript configuration locally, it indicates that the properties are disabled due to the presence of the tsconfig.json file.
This discrepancy between local and remote builds leads me to believe that the remote build server may not be up-to-date and is not recognizing my tsconfig.json file.
Here is my tsconfig.json file for reference...
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
},
"compileOnSave": true
}
EDIT
Update: A recent discovery suggests that my tsconfig.json is not being read during the TFS build process.
Here is a comparison of the local MSBuild log versus the remote TFS build log...
Local MSBuild Log:
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.8\tsc.exe --project "C:\[MY PATH GOES HERE]\tsconfig.json"
Remote TFS Build Log:
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.5\tsc.exe --sourcemap --target ES5 --noEmitOnError COMPUTE_PATHS_ONLY
It appears that the build server uses TypeScript 1.5, while I have 1.8 locally. Updating TypeScript on the TFS server should resolve this issue, as 1.8 offers improved support for tsconfig.json in Visual Studio.