MVC-Visual Studio 2008 [英] MVC - Visual Studio 2008

查看:73
本文介绍了MVC-Visual Studio 2008的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Visual Studio 2008构建MVC应用程序需要哪些先决条件?

What are the prerequisites that are required to build an MVC application using Visual Studio 2008?

推荐答案

您是否在谈论ASP.NET MVC Web应用程序? />
如果是; VS2008中有ASP.NET MVC Web应用程序模板吗?
Are you talking about ASP.NET MVC Web application?

If yes; do you have ASP.NET MVC Web Application template in VS2008?



我认为这可能对您有帮助

可以从以下页面下载适用于Visual Studio 2008 SP1的ASP.NET MVC 2 Release Candidate: http://go.microsoft.com/fwlink/?LinkID=157071

可以安装ASP.NET MVC 2,并且可以与ASP.NET MVC 1.0并行运行.
注意::由于Visual Studio 2008和Visual Studio 2010 Beta 2共享ASP.NET MVC 2的一个组件,因此不支持在还安装了Visual Studio Beta 2的计算机上安装ASP.NET MVC 2 Release Candidate版本.


将ASP.NET MVC 1.0项目升级到ASP.NET MVC 2

要将现有的ASP.NET MVC 1.0应用程序升级到版本2,请按照下列步骤操作:

1)对现有项目进行备份.

2)在文本编辑器中打开项目文件(文件扩展名为.csproj或.vbproj),然后找到ProjectTypeGuid元素.作为该元素的值,将GUID {603c0e0b-db56-11dc-be95-000d561079b0}替换为{F85E285D-A4E0-4152-9332-AB1D724D3325}.
完成后,该元素的值应如下所示:

< projecttypeguids> {F85E285D-A4E0-4152-9332-AB1D724D3325}; {349c5851-65df-11da-9384-00065b846f21}; {fae04ec0-301f-11d3-bf4b-00c04f79efbc}

1)在Web应用程序的根文件夹中,编辑Web.config文件.搜索System.Web.Mvc,版本= 1.0.0.0,并将所有实例替换为System.Web.Mvc,版本= 2.0.0.0.



2)对Views目录中的Web.config文件重复上一步.

3)使用Visual Studio打开项目,然后在解决方案资源管理器中,展开引用"节点.删除对System.Web.Mvc的引用(指向版本1.0程序集).添加对System.Web.Mvc(v2.0.0.0)的引用.


4)在configuraton部分下的应用程序根目录中的Web.config文件中添加以下bindingRedirect元素:

< runtime>
< assemblybinding xmlns ="urn:schemas-microsoft-com:asm.v1">
< dependentassembly>
< assemblyidentity name ="System.Web.Mvc">
publicKeyToken ="31bf3856ad364e35"/>
< bindingredirect oldversion ="1.0.0.0" newversion ="2.0.0.0">





5)创建一个新的ASP.NET MVC 2应用程序.将文件从新应用程序的Scripts目录复制到现有应用程序的Scripts目录中.
6)编译应用程序并运行它.

I think this may help you

The ASP.NET MVC 2 Release Candidate for Visual Studio 2008 SP1 can be downloaded from the following page:
http://go.microsoft.com/fwlink/?LinkID=157071

ASP.NET MVC 2 can be installed and can run side-by-side with ASP.NET MVC 1.0.
Note ::Because Visual Studio 2008 and Visual Studio 2010 Beta 2 share a component of ASP.NET MVC 2, installing the ASP.NET MVC 2 Release Candidate release on a computer where Visual Studio Beta 2 is also installed is not supported


Upgrading an ASP.NET MVC 1.0 Project to ASP.NET MVC 2

To upgrade an existing ASP.NET MVC 1.0 application to version 2, follow these steps:

1)Make a backup of the existing project.

2)Open the project file in a text editor (the file with the .csproj or .vbproj file extension) and find the ProjectTypeGuid element. As the value of that element, replace the GUID {603c0e0b-db56-11dc-be95-000d561079b0} with {F85E285D-A4E0-4152-9332-AB1D724D3325}.
When you are done, the value of that element should be as follows:

<projecttypeguids>{F85E285D-A4E0-4152-9332-AB1D724D3325};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}

1) In the Web application root folder, edit the Web.config file. Search for System.Web.Mvc, Version=1.0.0.0 and replace all instances with System.Web.Mvc, Version=2.0.0.0.



2)Repeat the previous step for the Web.config file located in the Views directory.

3)Open the project using Visual Studio, and in Solution Explorer, expand the References node. Delete the reference to System.Web.Mvc (which points to the version 1.0 assembly). Add a reference to System.Web.Mvc (v2.0.0.0).


4)Add the following bindingRedirect element to the Web.config file in the application root under the configuraton section:

<runtime>
<assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentassembly>
<assemblyidentity name="System.Web.Mvc">
publicKeyToken="31bf3856ad364e35"/>
<bindingredirect oldversion="1.0.0.0" newversion="2.0.0.0">





5)Create a new ASP.NET MVC 2 application. Copy the files from the Scripts directory of the new application into the Scripts directory of the existing application.

6)Compile the application and run it.


这篇关于MVC-Visual Studio 2008的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆