Visual Studio “Add Controller” list of model class

2019-04-25 07:20发布

The "Add Controller" dialog on an MVC project provides a dropdown list of model classes to choose from. These are usually the model classes in the project, and that's what I used to see. But now I'm getting this:

Add Controller dialog in Visual Studio

Any idea what's wrong and how to change it back to what I believe is the normal way?

2条回答
我欲成王,谁敢阻挡
2楼-- · 2019-04-25 07:37

It seems there's no solution to this problem. That dialog shows the classes from all the classes in the solution, and that includes any 3rd party classes that were imported (using something like NuGet). Which kind of makes sense. So it's a feature, not a bug.

The workaround to sifting through that whole list is to take advantage of the autocomplete functionality built into that dialog, which makes it quite easy to find the required full class name.

查看更多
【Aperson】
3楼-- · 2019-04-25 07:58

I often run into a problem with that dialog box "forgetting" classes and showing odd choices. Closing and restarting VS has always cleared the problem up for me.

查看更多
登录 后发表回答