Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

the value -1 is outside the acceptable range of [0,2147483647]. Parameter name: value

Problem with scaffolding any controller using visual studio 2019 i get the error :
"there was an error running the selected code generator: 'The value -1 is outside the acceptable range of [0,2147483647]. Parameter name :value'"

Related links i have tried and still this issues persist

I tried the following :
1. (Error while generating view in Visual Studio 2019)
2. (Can't Add View from Controller in VS 2015 : "There was an error running the selected code generator")

like image 908
Crate Duke Avatar asked Aug 06 '19 17:08

Crate Duke


4 Answers

The issue is now fixed with the latest release of Visual Studio 2019: version 16.2.5: https://learn.microsoft.com/en-us/visualstudio/releases/2019/release-notes#16.2.5

The issue would only to happen when:

  • you have the web.config file for your project open in Visual Studio.

So the workaround for was:

  • if you have the error, make sure you close the web.config file and you will be able to scaffold controllers.
like image 157
Paul Cociuba Avatar answered Nov 03 '22 09:11

Paul Cociuba


I ran into the same problem tomorrow, tried many manipulations found on different subjects, nothing worked. Finally, someone gave me a "solution" that let me continue my project, which simply is copy/paste any view...! Of course, you'll then have to hand code everything, but at least it'll let you add new views/controllers to your project. Hope this helps!

like image 1
Jueverhard Avatar answered Nov 03 '22 08:11

Jueverhard


I just found how to solve it for me after attempting many things.

My solution was to:

  • first navigate to the project folder with the solution and delete the packages folder.
    • Also delete .vs folder in the root of your solution
  • Then in your project folder delete the bin and obj folders.
  • Close your Visual Studio instance.
  • Next step is to navigate to your local user folder:

    Ex: C:\Users\[YourUserName]\AppData\Local\Microsoft\VisualStudio

You will see folders 16.0_ or 16.0_e9eb2d6b (Depending on your VS version). Navigate to the second folder 16.0_e9eb2d6b and delete the ComponentModelCache and Designer folders.

  • Close web.config file in the editor

  • Last step is to open your solution project in VisualStudio and click on Rebuild Solution from the Build tab.

Now try to create a View in your MVC project.

I hope this helps!

like image 1
Konstantin Dinev Avatar answered Nov 03 '22 09:11

Konstantin Dinev


Before Creating a View or Controller Make sure that your Web.config file is not open...

like image 1
Pias Uddin Jibon Avatar answered Nov 03 '22 08:11

Pias Uddin Jibon