asp.net mvc中突然无法添加新model

prettywolf 2018-05-31 03:00:19
之前在Models目录下有几个类,现在在相同的目录下创建新类,namespace都是一样的。
为了方便测试,我在同一个Controller和Action中创建实例,我发现新加的类无法找到定义了。vs已经是最新社区版。尝试了清理解决方案和重新生成解决方案。问题依旧。解决方案有22个项目,难道社区版有限制吗?
下图中DeviceGeneratorMobile是新添加的类。devicereply是之前添加的。

对比一下2个类的内容,可以看到2个类的namespace是相同的,而且同在Models目录下。


测试2个类在同一个方法中的调用情况:

显示可能的修补程序:


可以确定的是,类名在整个解决方案中是没有重复的。我实在无法定位问题,请大神指点。
...全文
275 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
prettywolf 2018-05-31
  • 打赏
  • 举报
回复
引用 1 楼 a755362405 的回复:
1、重启VS
果然。
键盘敲出字 2018-05-31
  • 打赏
  • 举报
回复
1、重启VS
Book Description Develop next-generation web applications with ASP.NET MVC Go deep into the architecture and features of ASP.NET MVC 5, and learn how to build web applications that work well on both the desktop and mobile devices. Web development expert Dino Esposito takes you through the web framework’s Model-View-Controller (MVC) design model, and covers the tools you need to cleanly separate business logic from the user interface. If you’re an experienced web developer new to ASP.NET MVC, this practical guide will get you going. Discover how to: Build web applications that are easy to test and maintain Dive into the functions of controllers—the heart of an MVC site Explore the structure and behavior of a view engine Process a variety of input data using a custom model binder Automate the writing of input forms, and streamline validation Design websites for mobile devices, localization, and error handling Provide security by implementing a membership system Inject script code into your site using JavaScript and jQuery Use Responsive Web Design to make sites mobile-friendly Table of Contents Part I: ASP.NET MVC fundamentals Chapter 1. ASP.NET MVC controllers Chapter 2. ASP.NET MVC views Chapter 3. The model-binding architecture Chapter 4. Input forms Part II: ASP.NET MVC software design Chapter 5. Aspects of ASP.NET MVC applications Chapter 6. Securing your application Chapter 7. Design considerations for ASP.NET MVC controllers Chapter 8. Customizing ASP.NET MVC controllers Chapter 9. Testing and testability in ASP.NET MVC Chapter 10. An executive guide to Web API Part III: Mobile clients Chapter 11. Effective JavaScript Chapter 12. Making websites mobile-friendly Chapter 13. Building sites for multiple devices Book Details Paperback: 516 pages Publisher: Microsoft Press; 3rd Edition (February 2014) Language: English ISBN-10: 0735680949 ISBN-13: 978-0735680944
The ASP.NET MVC 5 Framework is the latest evolution of Microsoft’s ASP.NET web platform. It provides a high-productivity programming model that promotes cleaner code architecture, test-driven development, and powerful extensibility, combined with all the benefits of ASP.NET. ASP.NET MVC 5 contains a number of advances over previous versions, including the ability to define routes using C# attributes and the ability to override filters. The user experience of building MVC applications has also been substantially improved. The new, more tightly integrated, Visual Studio 2013 IDE has been created specifically with MVC application development in mind and provides a full suite of tools to improve development times and assist in reporting, debugging and deploying your code. The popular Bootstrap JavaScript library has also now been included natively within MVC 5 providing you, the developer, with a wider range of multi-platform CSS and HTML5 options than ever before without the penalty of having to load-in third party libraries. What you’ll learn Gain a solid architectural understanding of ASP.NET MVC 5 Explore the entire ASP.NET MVC Framework as a cohesive whole Learn what's new in version 5 and how best to apply these new features to your own work See how MVC and test-driven development work in action Capitalize on your existing knowledge quickly and easily through comparison of features in classic ASP.NET to those in ASP.NET MV Who this book is for This book is for web developers with a basic knowledge of ASP.NET and C#who want, or need, to start using the new ASP.NET MVC 5 Framework. Table of Contents Part I: Introducing ASP.NET MVC 5 1. What's The Big Idea 2. Your first MVC Application 3. The MVC Pattern 4. Essential Language Features 5. Working with Razor 6. Essential Tools for MVC 7. Sports Store: A Real Application 8. Sports Store: Navigation 9. Sports Store: Cart 10. Sports Store: Mobile 11. Sports Store: Admin 12. Sports Store: Security and Finishing Touches 13. Deployment Part II: ASP.NET MVC 5 In Detail 14. Overview of MVC5 Projects 15. URL Routing 16. Advanced Routing Features 17. Controllers and Actions 18. Filters 19. Controllers Extensibility 20. Views 21. Helper Methods 22. Templated Helper Methods 23. URL and Ajax Helper Meothods 24. Model Binding 25. Model Validation 26. Bundles 27. WebAPI and Single Page Applications

110,538

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧