[英]How do I make a MVC project appear properly in Visual Studio?
How do I make a MVC project appear properly in Visual Studio? 如何在Visual Studio中正确显示MVC项目? I understand the logic of this sort of structure.
我理解这种结构的逻辑。 I have seen some blogs and explanations and even code segments explaining how a program can use MVC.
我已经看到一些博客和解释,甚至代码段解释了程序如何使用MVC。 But I want to know what is a good way to represent a Model-View-Controller program in the Visual Studio.
但我想知道在Visual Studio中表示模型 - 视图 - 控制器程序的好方法是什么。
For example, in an ASP.NET program, the asp.net file is associated with a C# file. 例如,在ASP.NET程序中,asp.net文件与C#文件相关联。 THey have the same name and, in the Solution Explorer window of the Visual Studio development environment, they are shown linked together where one is a tree branch of the other.
它们具有相同的名称,并且在Visual Studio开发环境的“解决方案资源管理器”窗口中,它们显示为链接在一起,其中一个是另一个的树分支。 Should the same sort of thing be done for a MVC solution?
是否应该为MVC解决方案做同样的事情? I can remember a few years ago, I worked on a MVVM project, and a developer who first put the solution file together actually had view and the view-model files arranged like this.
我记得几年前,我参与过一个MVVM项目,一个首先将解决方案文件放在一起的开发人员实际上有视图,视图模型文件就是这样排列的。 In order to make this happen, he had to download some sort of patch that allowed him to edit the .sln (solution) file.
为了实现这一点,他必须下载某种补丁,允许他编辑.sln(解决方案)文件。
Is that the way to go for a Model-View-Controller program? 这是模型 - 视图 - 控制器程序的方法吗? Should each be its own workspace in the solution, or should the solution file be edited such that each Model-View-Controller coupling be handled as a tree structure file representation kind of like it is done for an ASP.NET solution?
每个应该是解决方案中自己的工作空间,还是应该编辑解决方案文件,以便将每个模型 - 视图 - 控制器耦合作为树结构文件表示处理,就像对ASP.NET解决方案一样?
Here is another question. 这是另一个问题。 What is a good template to use in Visual Studio to create an example of a Model-View-Controller program?
在Visual Studio中使用什么样的好模板来创建模型 - 视图 - 控制器程序的示例? I tried this route but when I clicked to "get new templates", it did not work:
我尝试过这条路线但是当我点击“获取新模板”时,它无效:
http://i67.photobucket.com/albums/h292/Athono/Embedded/Capture_02_zps6vn4ri07.png
http://i67.photobucket.com/albums/h292/Athono/Embedded/Capture_02_zps6vn4ri07.png
http://i67.photobucket.com/albums/h292/Athono/Embedded/Capture_zpscdczk1b4.png
http://i67.photobucket.com/albums/h292/Athono/Embedded/Capture_zpscdczk1b4.png
From your screenshots, it looks like you're using an old version of Visual Studio (either 2008 or 2010, there isn't enough showing to be sure, but I see the default .NET framework listed as 3.5 up there). 从你的截图中看,你看起来像是在使用旧版本的Visual Studio(2008年或2010年,没有足够的展示确定,但我看到默认的.NET框架在那里列为3.5)。
The latest versions of the ASP.NET MVC framework requires .NET 4.5. 最新版本的ASP.NET MVC框架需要.NET 4.5。 Visual Studio 2010 doesn't support this, so the solution is to upgrade to a newer version of Visual Studio which includes support and project templates specifically for the latest versions of ASP.NET MVC.
Visual Studio 2010不支持此功能,因此解决方案是升级到较新版本的Visual Studio,其中包含专门针对最新版本的ASP.NET MVC的支持和项目模板。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.