2012-10-15 39 views
5

thể trùng lặp:
MVC 4 Beta side by side installation errorMVC 3 ngừng hoạt động sau khi cài đặt MVC4

Tôi có một ứng dụng MVC3 cơ bản dở dang. Tôi muốn bắt đầu một ứng dụng khác trong MVC4. Nhưng ứng dụng MVC 3 ngừng hoạt động sau khi cài đặt MVC 4 (không phải beta). nhận được một số lỗi xung đột dll. Một trong những lỗi là như thế này.

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)` 

điều gì sẽ là khắc phục cho điều này?

+0

Tôi có làm theo điều này? http://stackoverflow.com/questions/9471263/mvc-4-beta-side-by-side-installation-error – amesh

Trả lời

15

Tôi tìm thấy giải pháp here

Cài đặt ASP.NET MVC 4 phá vỡ ASP.NET MVC 3 ứng dụng RTM. ASP.NET MVC 3 ứng dụng được tạo ra với bản phát hành RTM (không có bản phát hành Cập nhật công cụ ASP.NET MVC 3) yêu cầu những thay đổi sau đây để làm việc song song với ASP.NET MVC 4. Xây dựng dự án mà không cần làm cho các bản cập nhật này dẫn đến lỗi biên dịch. Các cập nhật bắt buộc

Trong tệp Web.config gốc, thêm mục nhập mới với trang web chính: Phiên bản và giá trị 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> 

Trong Solution Explorer, nhấp chuột phải vào tên dự án và sau đó chọn Dỡ bỏ dự án. Sau đó nhấp chuột phải vào tên và chọn Edit ProjectName.csproj. Xác định vị trí tài liệu tham khảo lắp ráp sau:

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

Thay thế chúng với những điều sau:

<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" /> 

Lưu các thay đổi, đóng dự án (csproj) tập tin bạn đang chỉnh sửa, và sau đó kích chuột phải vào dự án và chọn Tải lại.

(Bạn có thể tự chỉnh sửa hồ sơ dự án MVC trong soạn thảo văn bản cũng có. Nhấp chuột phải vào file csproj và cởi mở với bất kỳ soạn thảo văn bản và chỉnh sửa cẩn thận xml)

+0

Cảm ơn! Trong trường hợp của tôi, tôi chỉ cần thay thế dòng ** ** trong .csproj, sau đó biên dịch lại và nó đã hoạt động! ... được đánh giá cao. – MarioAraya

Các vấn đề liên quan