对装饰器的实验性支持 visual studio 2017
experimental support for decorators visual studio 2017
我在 Visual Studio 2017 年创建了一个带有 AngularJS 的 .Net Core 项目,但是当我尝试创建服务时,出现
错误
Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option `to remove this warning.
我检查了几个链接,例如编辑 tsconfig.json 以下链接,例如
link1 and
现在我的 tsconfig.json 看起来像下面
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"experimentalDecorators": true,
"allowJs": true,
"noEmit": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
},
"include": [
"app/**/*"
],
"files": [], //add a "files" array (in my case empty)
"exclude": [
"node_modules"
],
"typeAcquisition": {
"enable": true // helps fuel better js intellisense
}
}
但我仍然看到错误,我现在一头雾水。
添加
<PropertyGroup>
<TypeScriptExperimentalDecorators>true</TypeScriptExperimentalDecorators></PropertyGroup>
在您项目的 .csproj 文件中,因为它将优先于 tsconfig.json 文件
并重新启动 visual studio 并且错误不再存在。
同样的问题,这让我很生气。
添加项目的 .csproj 文件
<ItemGroup>
<Content Include="ClientApp\tsconfig.json">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
</ItemGroup>
在您的 .csproj 中,添加以下 PropertyGroup 以抑制 experimentalDecorator 错误(撰写本文时为 1219)。之后您可能需要重新加载您的项目。
这也适用于 VS 2019。
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<NoWarn>1219;</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<NoWarn>1219;</NoWarn>
</PropertyGroup>
我在 Visual Studio 2017 年创建了一个带有 AngularJS 的 .Net Core 项目,但是当我尝试创建服务时,出现
错误Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option `to remove this warning.
我检查了几个链接,例如编辑 tsconfig.json 以下链接,例如
link1 and
现在我的 tsconfig.json 看起来像下面
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"experimentalDecorators": true,
"allowJs": true,
"noEmit": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
},
"include": [
"app/**/*"
],
"files": [], //add a "files" array (in my case empty)
"exclude": [
"node_modules"
],
"typeAcquisition": {
"enable": true // helps fuel better js intellisense
}
}
但我仍然看到错误,我现在一头雾水。
添加
<PropertyGroup>
<TypeScriptExperimentalDecorators>true</TypeScriptExperimentalDecorators></PropertyGroup>
在您项目的 .csproj 文件中,因为它将优先于 tsconfig.json 文件 并重新启动 visual studio 并且错误不再存在。
同样的问题,这让我很生气。
添加项目的 .csproj 文件
<ItemGroup>
<Content Include="ClientApp\tsconfig.json">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
</ItemGroup>
在您的 .csproj 中,添加以下 PropertyGroup 以抑制 experimentalDecorator 错误(撰写本文时为 1219)。之后您可能需要重新加载您的项目。 这也适用于 VS 2019。
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<NoWarn>1219;</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<NoWarn>1219;</NoWarn>
</PropertyGroup>