我已经将我的.NET核心3.1+Angular 9.1更新为角10.0.2,我使用了以下步骤:
ng update @angular/core @angular/cli在此之后,VS 2019 v 16.6.3没有显示智能感知和验证,项目运行就没有问题。如果我在VS代码中打开项目,所有工作都很好。
我发现问题就在我运行ng update @angular/cli之后
将工程恢复到9.1所有工作都很好
谢谢
发布于 2020-07-04 07:54:19
我在将一个项目升级到角10之后也遇到了同样的问题,这似乎是一个问题,因为最新版本的VisualStudio2019没有处理tsconfig.json文件和introduction tsconfig.base.json的更改。
作为解决办法,直到在VS 2019年中解决了这个问题,我将tsconfig.base.json的内容复制到tsconfig.json并注释掉了升级的配置。
我现在有了这样的和文件,旧的功能被恢复。
/*
This is a "Solution Style" tsconfig.json file, and is used by editors and TypeScript’s language server to improve development experience.
It is not intended to be used to perform a compilation.
To learn more about this file see: https://angular.io/config/solution-tsconfig.
removed this as causes vs 2019 to fail - the config details are copied from base so when this is sort we can revert
"files": [],
"references": [
{
"path": "./src/tsconfig.app.json"
},
{
"path": "./src/tsconfig.spec.json"
},
{
"path": "./src/tsconfig.server.json"
},
{
"path": "./e2e/tsconfig.e2e.json"
}
]
*/
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"module": "esnext",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
},
"angularCompilerOptions": {
"enableIvy": true
}
}发布于 2020-07-17 19:13:34
更新
这似乎适用于visual studio 16.7.1。
当我更新到角10时,我也遇到了同样的问题。它似乎是一个已知问题,并且修复已经在预览中可用。
直到该补丁向公众开放为止,接下来的tsconfig.json更改将为我解决这个问题。
{
"extends": "./tsconfig.base.json"
}发布于 2020-07-14 13:54:54
当我从9角移到10角时,我也遇到了同样的问题。
我发现以下几点对我是有用的:
TL;博士
在所有“项目”级别的tsconfig文件(tsconfig.app.json、tsconfig.spec.json、tsconfig.e2e.json)中,只需从以下位置更改‘Extended’属性:
{
"extends": "../tsconfig.json"
...
}以下各点:
{
"extends": "../tsconfig.base.json"
...
}全版本
在运行ng update之前,我有以下结构:
ClientApp
|_ tsconfig.json
|_ src
|_ tsconfig.app.json
|_ tsconfig.spec.json
|_ e2e
|_ tsconfig.e2e.json在运行ng update之后,我有以下结构:
ClientApp
|_ tsconfig.json
|_ tsconfig.base.json
|_ src
|_ tsconfig.app.json
|_ tsconfig.spec.json
|_ e2e
|_ tsconfig.e2e.json在阅读了角度迁移注释之后,我注意到我的tsconfig.json和tsconfig.base.json版本是相同的。这仍然有效,但它不符合在笔记中描述的角度。所以我决定改变我的`tsconfig.json。手动执行以下操作:
{
"files": [],
"references": [
{
"path": "./src/tsconfig.app.json"
},
{
"path": "./src/tsconfig.spec.json"
},
{
"path": "./e2e/tsconfig.e2e.json"
}
]
}和其他人一样,它破坏了我的应用程序。
所以我看了一下'project‘级的tsconfig文件,注意到’tsconfig.json‘属性仍然指向tsconfig.base.json,而不是tsconfig.base.json。在将我的“项目”级别的tsconfig文件更新为指向tsconfig.base.json文件之后,一切都成功了。
快乐的日子!
:-)
我猜想ng update应该“自动”地找到和更新所有的‘项目’级别的tsconfig文件,但是看起来并非如此。
更新
尽管更改了extends属性确实解决了我的编译问题。当我第二天关闭并重新打开Visual时,IntelliSense开始失败。
只有使tsconfig.json与tsconfig.base.json相同,我才能使编译和IntelliSense工作。
https://stackoverflow.com/questions/62672746
复制相似问题