- 
                Notifications
    
You must be signed in to change notification settings  - Fork 13.1k
 
Setting Compiler Options in MSBuild projects
        Daniel Rosenwasser edited this page Aug 24, 2015 
        ·
        20 revisions
      
    Compiler options can be specified using MSBuild properties within an MSBuild project.
  <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
    <TypeScriptRemoveComments>false</TypeScriptRemoveComments>
    <TypeScriptSourceMap>true</TypeScriptSourceMap>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)' == 'Release'">
    <TypeScriptRemoveComments>true</TypeScriptRemoveComments>
    <TypeScriptSourceMap>false</TypeScriptSourceMap>
  </PropertyGroup>
  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets')" />| Compiler Option | MSBuild Property Name | Allowed Values | 
|---|---|---|
--declaration | 
TypeScriptGeneratesDeclarations | boolean | 
--module | 
TypeScriptModuleKind | 
AMD, CommonJs, UMD, or System
 | 
--target | 
TypeScriptTarget | 
ES3, ES5, or ES6
 | 
--charset | 
TypeScriptCharset | |
--emitBOM | 
TypeScriptEmitBOM | boolean | 
--emitDecoratorMetadata | 
TypeScriptEmitDecoratorMetadata | boolean | 
--experimentalDecorators | 
TypeScriptExperimentalDecorators | boolean | 
--inlineSourceMap | 
TypeScriptInlineSourceMap | boolean | 
--inlineSources | 
TypeScriptInlineSources | boolean | 
--locale | 
Automatically set to PreferredUILang value | |
--mapRoot | 
TypeScriptMapRoot | File path | 
--newLine | 
TypeScriptNewLine | 
CRLF or LF
 | 
--noEmitOnError | 
TypeScriptNoEmitOnError | boolean | 
--noEmitHelpers | 
TypeScriptNoEmitHelpers | boolean | 
--noImplicitAny | 
TypeScriptNoImplicitAny | boolean | 
--noLib | 
TypeScriptNoLib | boolean | 
--noResolve | 
TypeScriptNoResolve | boolean | 
--out | 
TypeScriptOutFile | File path | 
--outDir | 
TypeScriptOutDir | File path | 
--preserveConstEnums | 
TypeScriptPreserveConstEnums | boolean | 
--removeComments | 
TypeScriptRemoveComments | boolean | 
--rootDir | 
TypeScriptRootDir | File path | 
--separateCompilation | 
TypeScriptSingleFile | boolean | 
--sourceMap | 
TypeScriptSourceMap | File path | 
--sourceRoot | 
TypeScriptSourceRoot | File path | 
--suppressImplicitAnyIndexErrors | 
TypeScriptSuppressImplicitAnyIndexErrors | boolean | 
--moduleResolution[1]
 | 
TypeScriptModuleResolution | 
Classic or NodeJs
 | 
--experimentalAsyncFunctions[1]
 | 
TypeScriptExperimentalAsyncFunctions | boolean | 
--project | 
Not supported in VS | |
--watch | 
Not supported in VS | |
--diagnostics | 
Not supported in VS | |
--listFiles | 
Not supported in VS | |
--noEmit | 
Not supported in VS | |
| VS only option | TypeScriptAdditionalFlags | Any compiler option | 
1 These settings are new in TypeScript 1.6
News
Debugging TypeScript
- Performance
 - Performance-Tracing
 - Debugging-Language-Service-in-VS-Code
 - Getting-logs-from-TS-Server-in-VS-Code
 - JavaScript-Language-Service-in-Visual-Studio
 - Providing-Visual-Studio-Repro-Steps
 
Contributing to TypeScript
- Contributing to TypeScript
 - TypeScript Design Goals
 - Coding Guidelines
 - Useful Links for TypeScript Issue Management
 - Writing Good Design Proposals
 - Compiler Repo Notes
 - Deployment
 
Building Tools for TypeScript
- Architectural Overview
 - Using the Compiler API
 - Using the Language Service API
 - Standalone Server (tsserver)
 - TypeScript MSBuild In Depth
 - Debugging Language Service in VS Code
 - Writing a Language Service Plugin
 - Docker Quickstart
 
FAQs
The Main Repo