Having trouble building typescript modules

I'm trying to add typescript modules to a build. The solution builds fine from the IDE, from MSBuild on the command line, and even on Visual Studio Online. However, when I build in TeamCity I get the following error:

     C:\TeamCity\buildAgent\work\cbd612042b438c8c\web\LobApp\CatBallBusinessWeb\Scripts\PurchaseOrderModule.ts(2, 15): error TS1148: Build: Cannot compile modules unless the '--module' flag is provided.

Apparently, the TeamCity build isn't picking up the right typescript.targets file. The line below from "C:\Program Files (x86)\msbuild\Microsoft\VisualStudio\v14.0\TypeScrip\Microsoft.TypeScript.targetst" is where the --module compiler flag should be applied.

     <TypeScriptBuildConfigurations Condition="'$(TypeScriptModuleKind)' != '' and '$(TypeScriptModuleKind)' != 'none'">$(TypeScriptBuildConfigurations) --module $(TypeScriptModuleKind)</TypeScriptBuildConfigurations>

In the relevant project settlings, under "TypeScript Build", I have the "AMD" Module system selected.. which shouldd trigger the line above.

The TeamCity build log differs from the build log I see when I compile with MSBuild from the command line here:

TeamCity:

[18:15:07] :  [web\LobApp\CatBallBusinessWeb\CatBallBusinessWeb.csproj] PreComputeCompileTypeScript

[18:15:07] :  [PreComputeCompileTypeScript] Using "VsTsc" task from assembly "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript\TypeScript.tasks.dll".

[18:15:07] :  [PreComputeCompileTypeScript] VsTsc

[18:15:07] :  [VsTsc] Task Parameter:ToolPath=C:\Program Files (x86)\Microsoft SDKs\TypeScript

[18:15:07] :  [VsTsc] Task Parameter:ToolExe=tsc.exe

[18:15:07] :  [VsTsc] Task Parameter:Configurations= --sourcemap --target ES5 --noEmitOnError COMPUTE_PATHS_ONLY

[18:15:07] :  [VsTsc] Task Parameter:

    FullPathsToFiles=

        Areas\Manage\Scripts\PurchaseOrderModule.ts

        Scripts\App\Purchase\PurchaseOrderEdit.ts

        Scripts\PurchaseOrderModule.ts

        Scripts\PurchaseOrderIndex.ts

        Scripts\typings\jquery\jquery.d.ts

        Scripts\typings\knockout.mapping\knockout.mapping.d.ts

        Scripts\typings\knockout.validation\knockout.validation.d.ts

        Scripts\typings\knockout\knockout.d.ts

        Scripts\typings\moment\moment-node.d.ts

        Scripts\typings\moment\moment.d.ts

Vs. MSBuild command line:

Target "PreComputeCompileTypeScript" in file "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript\Microsoft.TypeScript.targets" from project "D:\dev\web\lobapp\CatBallBusinessWeb\CatBallBusinessWeb.csproj" (target "CompileTypeScript" depends on it):

Using "VsTsc" task from assembly "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript\TypeScript.tasks.dll".

Task "VsTsc"

  Task Parameter:ToolPath=C:\Program Files (x86)\Microsoft SDKs\TypeScript

  Task Parameter:ToolExe=tsc.exe

  Task Parameter:Configurations= --module AMD --sourcemap --target ES5 --noEmitOnError COMPUTE_PATHS_ONLY

  Task Parameter:

      FullPathsToFiles=

          Areas\Manage\Scripts\PurchaseOrderModule.ts

          Scripts\App\Purchase\PurchaseOrderEdit.ts

          Scripts\PurchaseOrderModule.ts

          Scripts\PurchaseOrderIndex.ts

          Scripts\typings\jquery\jquery.d.ts

          Scripts\typings\knockout.mapping\knockout.mapping.d.ts

          Scripts\typings\knockout.validation\knockout.validation.d.ts

          Scripts\typings\knockout\knockout.d.ts

          Scripts\typings\moment\moment-node.d.ts

          Scripts\typings\moment\moment.d.ts

The highlighted part is missing from the TeamCity log.

In TeamCity, I'm building the solution directly.. the same one that builds fine everywhere else. I have Visual Studio 2015 tools selected. I should also mention that this solution builds from the command line from the TeamCity work directory.

I'm not a build, teamcity, or typescript expert. So I'm not sure how to investigate this further. How can I figure out why the right targets file isn't being run? Given that this builds fine everywhere else, I feel like it's a TeamCity bug. On the other hand, I can't imagine how TeamCity is running MSBuild wrong.

Any help appreciated.

2 comments
Comment actions Permalink

Hello,

Does the build run successfully if you use MSBuild runner in TeamCity? Did you run the build via the command line in the same working directory under the same user as the agent is running? Please follow the guideline from the online documentation. If it does not help to solve the issue, then please provide logs requested in the last paragraph.

0
Comment actions Permalink

Hi Alina,

Thanks for the reply. I converted the build step to use the msbuild runner instead of the visual studio runner and the build now works as expected. That's actually better for me anyway, I think, so great.

Thanks for the help!

Chris

0

Please sign in to leave a comment.