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")
The issue is now fixed with the latest release of Visual Studio 2019: version 16.2.5: https://docs.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.
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!
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
andobj
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!
VS team is still working on this issue:
However, I have used VS 2017 to add the Control and I re-opened the solution with 2019 version and it seems to work
This is what worked for me. Your mileage may vary.
1) Exit the solution from the IDE.
2) Delete the .vs folder (this may be hidden on your system)
3) Delete the packages folder under your solution.
4) Open the solution and perform Clean Solution from the IDE menu.
5) Restore the Nuget packages.
6) Try adding the new controller now.
Before Creating a View or Controller Make sure that your Web.config file is not open...
来源:https://stackoverflow.com/questions/57381260/the-value-1-is-outside-the-acceptable-range-of-0-2147483647-parameter-name