1

I have three folders in my visual studio 2017 solution.

  • project-a
  • project-b
  • lib

Each of these folders have a tsconfig.json file. I have setup these tsconfig files according to the typescript docs and to my older SO answer here: https://stackoverflow.com/a/54772741/681803

In visual studio code, I simply change my build script in my package.json from tsc to tsc --build. That will build all project listed in my project references list of my tsconfig.

However, I can't find out now how to do the same with visual studio 2017 (for another project)

When I build visual studio project-a (or project-b), it fails to build as the compiler can't find the references of the lib project (not build yet).

When I first manually run tsc in the common folder before building project-a or project-b, it does compile because the output folder now already contains the typescript definition files of the lib project which are needed for project-a and project-b.

How to setup visual studio 2017 to work with typescript project references?

ThdK
  • 9,916
  • 23
  • 74
  • 101

1 Answers1

2

Ah, I just found it when I was looking one more time at the typescript docs...

https://www.typescriptlang.org/docs/handbook/project-references.html#msbuild

If you have an msbuild project, you can enable build mode by adding

<TypeScriptBuildMode>true</TypeScriptBuildMode>

to your proj file. This will enable automatic incremental build as well as cleaning.

After updating my csproj file of my visual studio project with this flag, all project references are nicely being build.

ThdK
  • 9,916
  • 23
  • 74
  • 101
  • 1
    Hi ThdK, thanks for your sharing and please mark your reply as answer and that will help other community members who easier search this useful information, it just a reminder :) – LoLance Sep 10 '19 at 06:30