Code_Learner
Code_Learner

Reputation: 57

Code Generation error while creating Api Controller in VS 2019

I am trying to create a Web API controller, but it somehow always throws the following error:

There was an error running the selected code generator: The value -1 is outside the acceptable range of [02147483647]. Parameter name Value

I have removed the extra NuGet packages I added, like Cors, Owin, etc but it is still throwing that error

Upvotes: 1

Views: 1125

Answers (2)

Skr
Skr

Reputation: 571

I too got the same error while auto generating API controller code.

Since I was just messing around with a practice project, I just took the liberty to upgraded my project to the latest ASP.NET Core version along with the NuGet packages required by the code generating tool

  • Microsoft.EntityFrameworkCore
  • Microsoft.EntityFrameworkCore.SqlServer
  • Microsoft.EntityFrameworkCore.Tools

After the updates The Code generation tool worked properly.

Upvotes: 1

Jacques
Jacques

Reputation: 1

Try creating the Web Api via 'Web API Controller Class (v2.1).. this works for me..

Looks like an update problem with VS2019

Upvotes: 0

Related Questions