|
1 |
| -## Overview |
2 |
| -Compiler options can be specified using MSBuild properties within an MSBuild project. |
3 |
| - |
4 |
| -## Example |
5 |
| - |
6 |
| -```XML |
7 |
| - <PropertyGroup Condition="'$(Configuration)' == 'Debug'"> |
8 |
| - <TypeScriptRemoveComments>false</TypeScriptRemoveComments> |
9 |
| - <TypeScriptSourceMap>true</TypeScriptSourceMap> |
10 |
| - </PropertyGroup> |
11 |
| - <PropertyGroup Condition="'$(Configuration)' == 'Release'"> |
12 |
| - <TypeScriptRemoveComments>true</TypeScriptRemoveComments> |
13 |
| - <TypeScriptSourceMap>false</TypeScriptSourceMap> |
14 |
| - </PropertyGroup> |
15 |
| - <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets')" /> |
16 |
| -``` |
17 |
| - |
18 |
| -## Mappings |
19 |
| - |
20 |
| -Compiler Option | MSBuild Property Name | Allowed Values |
21 |
| -----------------|-----------------------|------------ |
22 |
| -`--declaration` | TypeScriptGeneratesDeclarations | boolean |
23 |
| -`--module` | TypeScriptModuleKind | `AMD`, `CommonJs`, `UMD`, or `System` |
24 |
| -`--target` | TypeScriptTarget | `ES3`, `ES5`, or `ES6` |
25 |
| -`--charset` | TypeScriptCharset | |
26 |
| -`--emitBOM` | TypeScriptEmitBOM | boolean |
27 |
| -`--emitDecoratorMetadata` | TypeScriptEmitDecoratorMetadata | boolean |
28 |
| -`--experimentalDecorators` | TypeScriptExperimentalDecorators | boolean |
29 |
| -`--inlineSourceMap` | TypeScriptInlineSourceMap | boolean |
30 |
| -`--inlineSources` | TypeScriptInlineSources | boolean |
31 |
| -`--locale` | *automatic* | Automatically set to PreferredUILang value |
32 |
| -`--mapRoot` | TypeScriptMapRoot | File path |
33 |
| -`--newLine` | TypeScriptNewLine | `CRLF` or `LF` |
34 |
| -`--noEmitOnError` | TypeScriptNoEmitOnError | boolean |
35 |
| -`--noEmitHelpers` | TypeScriptNoEmitHelpers | boolean |
36 |
| -`--noImplicitAny` | TypeScriptNoImplicitAny | boolean |
37 |
| -`--noLib` | TypeScriptNoLib | boolean |
38 |
| -`--noResolve` | TypeScriptNoResolve | boolean |
39 |
| -`--out` | TypeScriptOutFile | File path |
40 |
| -`--outDir` | TypeScriptOutDir | File path |
41 |
| -`--preserveConstEnums` | TypeScriptPreserveConstEnums | boolean |
42 |
| -`--removeComments` | TypeScriptRemoveComments | boolean |
43 |
| -`--rootDir` | TypeScriptRootDir | File path |
44 |
| -`--isolatedModules` | TypeScriptIsolatedModules | boolean |
45 |
| -`--sourceMap` | TypeScriptSourceMap | File path |
46 |
| -`--sourceRoot` | TypeScriptSourceRoot | File path |
47 |
| -`--suppressImplicitAnyIndexErrors` | TypeScriptSuppressImplicitAnyIndexErrors | boolean |
48 |
| -`--suppressExcessPropertyErrors` | TypeScriptSuppressExcessPropertyErrors | boolean |
49 |
| -`--moduleResolution` | TypeScriptModuleResolution | `Classic` or `Node` |
50 |
| -`--experimentalAsyncFunctions` | TypeScriptExperimentalAsyncFunctions | boolean |
51 |
| -`--jsx` | TypeScriptJSXEmit | `React` or `Preserve` |
52 |
| -`--reactNamespace`<sup>[1]</sup> |TypeScriptReactNamespace| |
53 |
| -`--skipDefaultLibCheck`<sup>[1]</sup> |TypeScriptSkipDefaultLibCheck| boolean |
54 |
| -`--allowUnusedLabels`<sup>[1]</sup> |TypeScriptAllowUnusedLabels| boolean |
55 |
| -`--noImplicitReturns`<sup>[1]</sup> |TypeScriptNoImplicitReturns| boolean |
56 |
| -`--noFallthroughCasesInSwitch`<sup>[1]</sup>|TypeScriptNoFallthroughCasesInSwitch| boolean |
57 |
| -`--allowUnreachableCode`<sup>[1]</sup> |TypeScriptAllowUnreachableCode| boolean |
58 |
| -`--forceConsistentCasingInFileNames`<sup>[1]</sup>|TypeScriptForceConsistentCasingInFileNames| boolean |
59 |
| -`--allowSyntheticDefaultImports`<sup>[1]</sup>|TypeScriptAllowSyntheticDefaultImports| boolean |
60 |
| -`--noImplicitUseStrict`<sup>[1]</sup>|TypeScriptNoImplicitUseStrict| boolean |
61 |
| -`--project` | *Not supported in VS* | |
62 |
| -`--watch` | *Not supported in VS* | |
63 |
| -`--diagnostics` | *Not supported in VS* | |
64 |
| -`--listFiles` | *Not supported in VS* | |
65 |
| -`--noEmit` | *Not supported in VS* | |
66 |
| -*VS only option* | TypeScriptAdditionalFlags | *Any compiler option* |
67 |
| - |
68 |
| -<sup>1</sup> These settings are new in TypeScript 1.8 |
69 |
| - |
70 |
| -## What is supported in my version of Visual Studio? |
71 |
| - |
72 |
| -Look in your `C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets` file. |
73 |
| -The authoritative mappings between MSBuild XML tags and `tsc` compiler options live in there. |
74 |
| - |
75 |
| - |
76 |
| -## ToolsVersion |
77 |
| - |
78 |
| -The value of `<TypeScriptToolsVersion>1.7</TypeScriptToolsVersion>` property in the project file identifies the compiler version to use to build (1.7 in this example). This allows a project to build against the save versions of the compiler on different machines. |
79 |
| - |
80 |
| -If `TypeScriptToolsVersion` is not specified, the latest compiler version installed on the machine will be used to build. |
81 |
| - |
82 |
| -Users using newer versions of TS, will see a prompt to upgrade their project on first load. |
83 |
| - |
84 |
| - |
85 |
| -## TypeScriptCompileBlocked |
86 |
| - |
87 |
| -If you are using a different build tool to build your project (e.g. gulp, grunt ,etc..) and VS for the development and debugging experience, set `<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>` in your project. This should give you all the editing support, but not the build when you hit F5. |
| 1 | +> ### This page has moved to http://www.typescriptlang.org/docs/handbook/compiler-options-in-msbuild.html |
0 commit comments