简体   繁体   中英

Visual Studio 2010 ASP.NET MVC: Create Strongly Typed View Not Showing My Classes

For some reason, when I create a new view and select 'Create Strongly Typed View', when I try to select a view data class from my project I find that its not in the list?

Classes from all my project's references (external references) are there, but NONE of mine?

I know this can be done manually, but (bloody) visual studio wont allow me to select a page template unless a view data class has been selected. Im sure this is something I have forgetten or changed somewhere by mistake. Hope someone can help!

这可能是一个愚蠢的建议,但是这对我来说唯一的一次是当我创建一个新的ViewModel并尝试创建一个强类型视图而不首先构建项目时。

I had this exact same issue, could not find the solution anywhere, and i really searched google, read many sites answers/suggestions, but nothing helped me, until i did this below.

Ok, you may have already figured out the answer by now, or even tried what i am about to suggest, but, save project, build project, just to be sure, then close project, then close vs altogether, then RUN VS AS ADMINISTRATOR, then open your project and add view, i bet you can now see the data classes in the View data class drop-down...!

Let me know if this worked for you.

//edit: just fyi, I don't think you would see this behavior in say Windows XP for instance, it must be due to the uac in Vista and 7, so I am assuming you are using one of these two. In my case i am using 7. I may have gotten this totally wrong, pardon me if i did, but it solved this issue for me, thanks.

//another edit: In fact, i think many problems with vs and sqlsrvr are related to permissions in vista and 7... just my thoughts.

I had similar issue. I try all the suggestions but installing Visual studio seems big process, Why not try rebuild the solution , then it show all the classes in the project ..Hope it definitely works

Jimbo - again 'stupid suggestion'. but are you checking for the fully qualified name of the project.classname?? So if you're looking for 'Albums' in the class list from the 'zulu' project, you'd have to scroll down to 'zulu.Albums'...

just a thought

I need to close this question as the problem is gone now - the solution?

Install Visual Studio 2010 - sorted :)

If anyone does find out why this happens, please just drop me a comment here and I will re-open the question for a successful answer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM