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

查看:25
本文介绍了将 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

在那之后 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天全站免登陆