Step 1 : right click to generate
Step 2 : setting
Step 3 : error message
Step 4 : my Model
how to settle this ? i cant generate create form
So far even if you try to add say, another view for an existing controller and an existing action, say ManageController.AddPhoneNumber
with the existing view model - AddPhoneNumberViewModel
, still the same exception is thrown despite there is already a view for the very same action and controller, using the very same view model.
No need to upload any more screenshots, or anything else, the problem seems to be in the VS 2017 code generator (a scaffolding view issue), and hopefully will be addressed in some of the following updates.
So be patient and use the copy/paste approach, you'll need to redesign your form anyway. Apparently, this is not a solution to your (my) problem, it only says - "you did nothing wrong, it's a VS bug, wait for an update".
I have faced this and similar issues relating to scaffolding a number of times, and my goto solution works pretty much every time - including for this specific issue.
- Right click Solution file
- Select "Rebuild Solution"
...And then try your action again.
This has worked for me many times in VS2017 and VS2019 - including today with the latest VS 2019.
It seems the scaffolding is being tripped up by something that is already built, for reasons unknown.
I also had the same problem, make sure there are no issues in your controller, I had unfinished code that caused the error, once I commented it out it created the view without any problems.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With