October 6, 2012 Leave a comment
The TypeScript compiler has the –c option to included comments, but this option is not available when working with Visual Studio.
The simple solution is to modify the .csproj project file and included –c in the call to the TypeScript compiler.
- Right-click on your project file in Visual Studio, and click Unload Project.
- Right-click again on the project file, and select Edit <your project name>.csproj
This will bring up the xml project file in edit mode.
Scroll down to the bottom of the file, and locate the following snippet:
<Target Name="BeforeBuild"> <Exec Command="&quot;$(PROGRAMFILES)\Microsoft SDKs\TypeScript\0.8.0.0\tsc&quot; @(TypeScriptCompile ->'"%(fullpath)"', ' ')" /> </Target>
Now add a –c after the tsc&quot; and before the @(TypeScriptCompile as follows:
\TypeScript.8.0.0\tsc" @(TypeScriptCompile ->
\TypeScript.8.0.0\tsc" -c @(TypeScriptCompile ->
Save the project file, and re-load it.
TypeScript will now include all comments within a .ts file into the generated .js file.