如何生成Angular.json文件 [英] How to generate Angular.json file

查看:368
本文介绍了如何生成Angular.json文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当前的应用程序是在没有Angular CLI的Angular 4中.所以我从来没有Angualr.json文件或Angular-cli.json文件.现在我们要生成该Angular CLI或angular.json文件.由于此文件不可用,因此不会执行任何ng命令(例如ng serve或ng g c testing)

My current application was in Angular 4 without Angular CLI. So I never had Angualr.json file or Angular-cli.json file. Now we want to generate that Angular CLI or angular.json file. Because this file is not available it is not taking any of the ng commands like ng serve or ng g c testing

如何在不使用ng new命令的情况下生成文件,因为ng new将创建一个我不需要的新项目.我想支持我现有的项目.

How can I generate the file without using ng new command because ng new will create a new project which I don't want. I want to support my existing project.

关于我的项目的几点注意事项: 1.我们正在从一个文件夹启动多个应用程序 2.我们正在从ASPX页面启动每个应用程序,而无需使用index.html.

Few notes on my project : 1. We are launching multiple application from one folder 2. We are launching each application from the ASPX page without using index.html.

请查看该错误的屏幕截图以及我的项目的文件夹结构输入图像描述这里

Please see the screen shot attached of the error and the folder structure of my projectenter image description here

在此处输入图片描述

推荐答案

创建一个名为".angular-cli.json"的新文件,并将其添加到您的主目录中.

Create a new file with name '.angular-cli.json' and add this file in your main directory.

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "project": {
    "name": "my-app"
  },
  "apps": [
    {
      "root": "src",
      "outDir": "dist",
      "assets": [
        "assets",
        "favicon.ico"
      ],
      "index": "index.html",
      "main": "main.ts",
      "polyfills": "polyfills.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.app.json",
      "testTsconfig": "tsconfig.spec.json",
      "prefix": "app",
      "styles": [
        "styles.css"
      ],
      "scripts": [],
      "environmentSource": "environments/environment.ts",
      "environments": {
        "dev": "environments/environment.ts",
        "prod": "environments/environment.prod.ts"
      }
    }
  ],
  "e2e": {
    "protractor": {
      "config": "./protractor.conf.js"
    }
  },
  "lint": [
    {
      "project": "src/tsconfig.app.json",
      "exclude": "**/node_modules/**"
    },
    {
      "project": "src/tsconfig.spec.json",
      "exclude": "**/node_modules/**"
    },
    {
      "project": "e2e/tsconfig.e2e.json",
      "exclude": "**/node_modules/**"
    }
  ],
  "test": {
    "karma": {
      "config": "./karma.conf.js"
    }
  },
  "defaults": {
    "styleExt": "css",
    "component": {}
  }
}

这篇关于如何生成Angular.json文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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