ng cli更新到版本10后,VS 2019没有智能感知和验证 [英] VS 2019 no intellisense and validation after ng cli update to version 10

查看:246
本文介绍了ng cli更新到版本10后,VS 2019没有智能感知和验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将.NET Core 3.1 + Angular 9.1更新为Angular 10.0.2, 我使用的步骤:

I've updated my .NET core 3.1+Angular 9.1 to Angular 10.0.2, steps I used:

  1. 将Vs TypeScript更新为 3.9.5
  2. 运行ng update @angular/core @angular/cli
  1. update Vs TypeScript to 3.9.5
  2. run ng update @angular/core @angular/cli

在此之后VS 2019 v 16.6.3没有显示智能感知和验证,项目运行没有问题. 如果我在VS Code中打开项目,则一切正常

After that VS 2019 v 16.6.3 shows no intellisense and validation,project runs without problems. If I open the project in VS Code all work fine

我发现问题出在我运行ng update @angular/cli

I've found the problem is just after I run ng update @angular/cli

将项目还原到9.1都可以正常工作

reverting project to 9.1 all works fine

谢谢

推荐答案

在将项目升级到Angular 10后,我遇到了相同的问题.这似乎是最新版本的Visual Studio 2019无法处理对tsconfig.json文件和tsconfig.base.json简介.

I experienced the same issue after upgrading a project to Angular 10. It appears to be an issue with the latest version of Visual Studio 2019 not handling the changes to the tsconfig.json file and the introduction tsconfig.base.json.

作为一种变通办法,直到在VS 2019中解决此问题为止,我将tsconfig.base.json的内容复制到tsconfig.json并注释了升级后的配置.

As a workaround until this is resolved in VS 2019 I copied the contents of tsconfig.base.json up to tsconfig.json and commented out the upgraded config.

我现在有一个看起来像这样的文件,并且恢复了旧功能

I now have and file that looks like this and the old functionality is restored

/*
  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
  }
}

这篇关于ng cli更新到版本10后,VS 2019没有智能感知和验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆