Gonçalo Peres
Gonçalo Peres

Reputation: 13582

Angular app 6 in ASP.NET Core: More than one module matches

Angular v6.1.10 | ASP.NET Core v2.2.102

I am building an Angular app from an ASP.NET Core template.

I want to create a component (fish-form).

In ASP.NET Core 2.0, a simple

ng g component fish-form --module=app.module.shared.ts

Would solve the problem, but with this architecture, as it doesn't have that file, it doesn't work.

This is the files structure.


I have also tried to create the component using

ng g component fish-form

But I am getting the following error:

Error: More than one module matches. Use skip-import option to skip importing the component into the closest module.

Command that I am running to create a form

Any help is appreciated.

Upvotes: 3

Views: 948

Answers (2)

M M
M M

Reputation: 725

You have two options

  1. ng g component fish-form --skipImport=true. This will remove the error, but not import the component.
  2. A better solution though ng g component fish-form --module=app.module.ts

Upvotes: 1

Gonçalo Peres
Gonçalo Peres

Reputation: 13582

This fixed the problem:

ng g component fish-form --module=app.module.ts

Upvotes: 3

Related Questions