зеркало из https://github.com/microsoft/JSTSdocs.git
Add explanation for new tsconfig warning (#6)
* Add explanation for new tsconfig warning * Respond to CR * Remove extra clause
This commit is contained in:
Родитель
c77045d2d6
Коммит
0010fd42c0
|
@ -26,13 +26,14 @@ Since a particular machine may have multiple versions of TypeScript installed, M
|
|||
## Input files
|
||||
There are two ways of including TypeScript files in the compilation: either using a tsconfig.json file or the `TypeScriptCompile` MSBuild item type.
|
||||
### With TSConfig
|
||||
One option for allowing MSBuild to recognize what TypeScript files are part of your project is by way of a tsconfig.json file. This configuration file can be registered for build configuration by being explicitly associated with your .csproj in the Content item list, as shown in the example below. Otherwise, if your project has no items included as part of the Content item list, it can be simply included as part of the directory tree rooted at the directory containing your project file.
|
||||
One option for allowing MSBuild to recognize what TypeScript files are part of your project is by way of a tsconfig.json file. This configuration file can be registered for build configuration by being explicitly associated with your .csproj in the TypeScriptCompile or Content item lists, as shown in the example below. Otherwise, if your project has no items included as part of either the TypeScriptCompile or Content item lists, it can be simply included as part of the directory tree rooted at the directory containing your project file.
|
||||
```xml
|
||||
<ItemGroup>
|
||||
<Content Include="myfolder/tsconfig.json" />
|
||||
<TypeScriptCompile Include="myfolder/tsconfig.json" />
|
||||
</ItemGroup>
|
||||
```
|
||||
Note that in the latter case, configuration files within a folder titled "node_modules", "bower_components", or "platforms" will not be considered in order to avoid duplicate symbol errors.
|
||||
Furthermore, note in TypeScript 3.5.1 and earlier, the Content item list must be used, as the TypeScriptCompile item list was not supported for `tsconfig.json` files.
|
||||
|
||||
The tsconfig.json can either explicitly enumerate the input files (in the "includes" property) or it can exclude files that should not be compiled (in the "excludes" property). The file also allows you to set compile options that will override those set in the TypeScript Build page of your project's Properties. For more details, refer to [the discussion of tsconfig.json files](xref:tsconfig).
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
# The `tsconfig.json` Build Action Warning
|
||||
|
||||
You may get an IntelliSense warning that reads "One or more tsconfig.json files in this project have their Build Action set to None and as a result may not be correctly used for configuration."
|
||||
|
||||
Before Visual Studio 2019 version 16.2, in order for a `tsconfig.json` file to be detected properly for configuring your editor experience, it had to have its Build Action set to `Content`. Similarly, when using TypeScript 3.5.2 or earlier with MSBuild, `tsconfig.json` files were also required have their Build Action set to `Content`. However, because this forces it to be published with your application, many users preferred to not set it as such, which caused unpredictable configuration issues for building and for the editor experience.
|
||||
|
||||
As of Visual Studio 2019 version 16.2 and TypeScript 3.5.3, we have added support for `tsconfig.json` files to have their Build Action set to `TypeScript file` (shown as `TypeScriptCompile` in older project types, such as ASP.NET Framework projects). This allows for the editor and build to be configured properly without being forced to publish the `tsconfig.json` files. As a result, we have introduced this warning to alert users to the potentially unpredictable state they may be in. Please note that, depending on your type of project, you may need to reload the project when updating the file's Build Action.
|
||||
|
||||
If you are unable to update the Build Action of a particular item, you also may add `<DisableTSConfigItemTypeWarning>true</DisableTSConfigItemTypeWarning>` to your project file to disable the warning. However, this will not resolve the configuration issues you may be experiencing, so we generally discourage this approach.
|
Загрузка…
Ссылка в новой задаче