如何做网站更新,网站收录没图片,贵阳建设工程招聘信息网站,电商公司是做什么的背景#xff1a;今天针对一个老项目进行框架升级#xff0c;老项目使用的是MVC 4#xff0c;现在要升级到MVC5。
备份项目.NET升级4.5以上版本通过Nuget#xff0c;更新或者直接安装包
包名oldVersionnewVersion说明Microsoft.AspNet.Mvc4.0.05.x.xMicrosoft.AspNet.Razo…背景今天针对一个老项目进行框架升级老项目使用的是MVC 4现在要升级到MVC5。
备份项目.NET升级4.5以上版本通过Nuget更新或者直接安装包
包名oldVersionnewVersion说明Microsoft.AspNet.Mvc4.0.05.x.xMicrosoft.AspNet.Razor2.0.03.0.0Microsoft.AspNet.WebPages2.0.03.0.0Microsoft.AspNet.WebApi.Core5.x.x如果使用了WebApiMicrosoft.Net.Http2.0.x2.2.x 4. 更新根目录的web.config重点
runtimeassemblyBinding xmlnsurn:schemas-microsoft-com:asm.v1!--Two elements removed for Clarity --dependentAssemblyassemblyIdentity nameSystem.Web.Helpers publicKeyToken31bf3856ad364e35 /bindingRedirect oldVersion1.0.0.0-3.0.0.0 newVersion3.0.0.0 //dependentAssemblydependentAssemblyassemblyIdentity nameSystem.Web.Mvc publicKeyToken31bf3856ad364e35 /bindingRedirect oldVersion1.0.0.0-5.0.0.0 newVersion5.0.0.0 //dependentAssemblydependentAssemblyassemblyIdentity nameSystem.Web.WebPages publicKeyToken31bf3856ad364e35 /bindingRedirect oldVersion1.0.0.0-3.0.0.0 newVersion3.0.0.0 //dependentAssembly!--WebGrease element removed for Clarity --/assemblyBinding
appSettingsadd keywebpages:Version value3.0.0.0 /add keywebpages:Enabled valuefalse /add keyPreserveLoginUrl valuetrue /add keyClientValidationEnabled valuetrue /add keyUnobtrusiveJavaScriptEnabled valuetrue /
/appSettings
5. 修改Views文件夹下的web.config重点
configuration
configSections
sectionGroup namesystem.web.webPages.razor typeSystem.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version3.0.0.0, Cultureneutral, PublicKeyToken31BF3856AD364E35
section namehost typeSystem.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version3.0.0.0, Cultureneutral, PublicKeyToken31BF3856AD364E35 requirePermissionfalse /
section namepages typeSystem.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version3.0.0.0, Cultureneutral, PublicKeyToken31BF3856AD364E35 requirePermissionfalse /
/sectionGroup
/configSections
system.web.webPages.razor
host factoryTypeSystem.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version5.0.0.0, Cultureneutral, PublicKeyToken31BF3856AD364E35 /
pages pageBaseTypeSystem.Web.Mvc.WebViewPage
namespaces
add namespaceSystem.Web.Mvc /
add namespaceSystem.Web.Mvc.Ajax /
add namespaceSystem.Web.Mvc.Html /
add namespaceSystem.Web.Routing /
/namespaces
/pages
/system.web.webPages.razor pages
validateRequestfalse
pageParserFilterTypeSystem.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version5.0.0.0, Cultureneutral, PublicKeyToken31BF3856AD364E35
pageBaseTypeSystem.Web.Mvc.ViewPage, System.Web.Mvc, Version5.0.0.0, Cultureneutral, PublicKeyToken31BF3856AD364E35
userControlBaseTypeSystem.Web.Mvc.ViewUserControl, System.Web.Mvc, Version5.0.0.0, Cultureneutral, PublicKeyToken31BF3856AD364E35
controls
add assemblySystem.Web.Mvc, Version5.0.0.0, Cultureneutral, PublicKeyToken31BF3856AD364E35 namespaceSystem.Web.Mvc tagPrefixmvc /
/controls
/pages
6. 右键项目卸载项目然后编辑项目文件.csproj
7. 找到 ProjectTypeGuids 节看一下里边是否包含{E3E379DF-F4C6-4180-9B81-6769533ABE47}如果包含就去掉这个有时候VS会帮助自动更换guid
8.右键项目重新加载项目
9. 如果有一些方法报错就重启一下项目再看。我这加载后碰到一个问题View中原来写的Html.Partial报错说没有Partial方法就很奇怪了后来捣鼓半天同事说重启一下项目吧果真就好了。。
10.检验是否能生成程序和功能是否正常。