ASP.NET MVC Add View Dialog closing

若如初见. 提交于 2019-12-01 23:08:15

问题


Recently a large project I work on started having a problem with the Add View dialog. When clicking the Add Strongly-typed View checkbox, the spinner comes up the first time for about a second or two, and then the entire dialog just closes and disappears. If I open the dialog and click the button again, it just closes again quickly.

The project is using ASP.NET MVC 2, I have installed VS2010 SP1 and this problem occurs with or without the MVC3 tools update installed. It only happens with this project, and I have replicated the problem on 2 different development machines. If I create a new MVC2 or MVC3 project, this does not happen at all, nor do any other small to medium sized projects I have.

I can of create a regular view and change it to strongly typed by myself, so there is a workaround, but this is still pretty annoying. Any ideas what could be causing this or how to fix it?


回答1:


Do you use version control? Make sure all the assemblies that your project depends on (i.e. referenced by the project itself or by its referenced assemblies) are in sync. I've just run into this (both "Add View" and "Add Controller" problems) after updating a bunch of projects from SVN and rebuilding some. The issue was fixed after I rebuilt several libraries that my MVC project depends on.




回答2:


I had the same problem, and I could not open the Add->Controller dialog either as described here: Add Controller after recent tools update fails with dependency error. In my case, I had added models to my domain, but I had forgotten to add contexts for these new models; things like

public DbSet<Region> Regions { get; set; }

I had no error at compile time, and I was not using these models yes in the solution, so there was no error at run time either. I guess the problem can be anywhere though.



来源:https://stackoverflow.com/questions/5841902/asp-net-mvc-add-view-dialog-closing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!