MVC 3站MVC4安装后的工作 [英] MVC 3 Stops working after MVC4 Installation

查看:85
本文介绍了MVC 3站MVC4安装后的工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:结果
   MVC 4 Beta版并排安装错误

我有一个正在进行中的MVC3应用程序。我想开始MVC4另一个应用程序。但MVC 3应用程序停止MVC 4安装(不是beta)后工作。得到一些DLL冲突的错误。一个错误是这样的。

I have an MVC3 application in progress. I want to start another application in MVC4. But MVC 3 application stopped working after MVC 4 installation(not beta). getting some dll conflicting errors. One of the error is like this.

The type 'System.Web.Helpers.Json' exists in both 'c:\Windows\Microsoft.NET\assembly\GAC_MSIL    \System.Web.Helpers\v4.0_2.0.0.0__31bf3856ad364e35\System.Web.Helpers.dll' and 'c:\Windows    \Microsoft.NET\assembly\GAC_MSIL\System.Web.Helpers    \v4.0_1.0.0.0__31bf3856ad364e35\System.Web.Helpers.dll' `at      System.Web.Compilation.AssemblyBuilder.Compile()
   at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
   at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
   at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean    noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean    ensureIsUpToDate)
   at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context,    VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile,    Boolean throwIfNotFound, Boolean ensureIsUpToDate)
   at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath,    HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound)
   at System.Web.Compilation.BuildManager.GetObjectFactory(String virtualPath, Boolean throwIfNotFound)
   at System.Web.Mvc.BuildManagerWrapper.System.Web.Mvc.IBuildManager.FileExists(String virtualPath)
   at System.Web.Mvc.BuildManagerViewEngine.FileExists(ControllerContext controllerContext, String   virtualPath)
   at System.Web.Mvc.VirtualPathProviderViewEngine.GetPathFromGeneralName(ControllerContext controllerContext, List`1 locations, String name, String controllerName, String areaName, String cacheKey, String[]& searchedLocations)
   at System.Web.Mvc.VirtualPathProviderViewEngine.GetPath(ControllerContext controllerContext, String[] locations, String[] areaLocations, String locationsPropertyName, String name, String controllerName, String cacheKeyPrefix, Boolean useCache, String[]& searchedLocations)
   at System.Web.Mvc.VirtualPathProviderViewEngine.FindView(ControllerContext controllerContext, String viewName, String masterName, Boolean useCache)
   at System.Web.Mvc.ViewEngineCollection.<>c__DisplayClassc.<FindView>b__b(IViewEngine e)
   at System.Web.Mvc.ViewEngineCollection.Find(Func`2 lookup, Boolean trackSearchedPaths)
   at System.Web.Mvc.ViewEngineCollection.Find(Func`2 cacheLocator, Func`2 locator)
   at System.Web.Mvc.ViewEngineCollection.FindView(ControllerContext controllerContext, String viewName, String masterName)
   at System.Web.Mvc.ViewResult.FindView(ControllerContext context)
   at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)
   at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19()
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
   at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1c.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b()
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
   at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1c.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b()
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)
   at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)`

这将是一个修复这个?

what would be a fix for this?

推荐答案

我找到了解决办法这里

安装ASP.NET MVC 4减免ASP.NET MVC 3 RTM的应用程序。那些与RTM版本(不与ASP.NET MVC 3工具更新版本)中创建ASP.NET MVC 3应用程序需要以如下修改工作并排侧ASP.NET MVC 4号楼项目,而不使得编译错误这些更新的结果。
所需的更新

Installing ASP.NET MVC 4 breaks ASP.NET MVC 3 RTM applications. ASP.NET MVC 3 applications that were created with the RTM release (not with the ASP.NET MVC 3 Tools Update release) require the following changes in order to work side-by-side with ASP.NET MVC 4. Building the project without making these updates results in compilation errors. Required updates

在根Web.config文件,添加具有关键的网页一个新的条目:版本和值1.0.0.0

In the root Web.config file, add a new entry with the key webPages:Version and the value 1.0.0.0.

<appSettings>
<add key="webpages:Version" value="1.0.0.0"/>
<add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
</appSettings>

在Solution Explorer中,用鼠标右键单击该项目名称,然后选择卸载项目。然后再次右键单击该名称并选择编辑ProjectName.csproj。
找到以下集的引用:

In Solution Explorer, right-click the project name and then select Unload Project. Then right-click the name again and select Edit ProjectName.csproj. Locate the following assembly references:

<Reference Include="System.Web.WebPages"/> 
<Reference Include="System.Web.Helpers" />

使用以下内容替换它们:

Replace them with the following:

<Reference Include="System.Web.WebPages, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL "/> 
<Reference Include="System.Web.Helpers, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />

保存更改,关闭项目(.csproj的)文件你正在编辑,然后用鼠标右键单击该项目并选择刷新。

Save the changes, close the project (.csproj) file you were editing, and then right-click the project and select Reload.

(您可以手动编辑MVC项目文件的文本编辑器也。右键单击的.csproj文件并打开用任何文本编辑器和编辑仔细XML)

(You can manually edit the MVC project file in text editor also. Right click the .csproj file and open with any text editor and edit carefully the xml)

这篇关于MVC 3站MVC4安装后的工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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