最近在学习asp.net mvc的源代码。当我吧项目中的原来的System.Web.Mvc移除添加mvc源代码编译后的System.Web.Mvc经常遇到一个错误。
相关错误信息如下:
c:\Users\majiang\AppData\Local\Temp\Temporary ASP.NET Files\root\7aaf28bd\6dc92822 \App_Web_index.cshtml.a8d08dba.luksia4z.0.cs(29): error CS0433: 类型“System.Web.Mvc.WebViewPage<TModel>”同时存在于“c:\Windows\Microsoft.NET \assembly\GAC_MSIL\System.Web.Mvc\v4.0_3.0.0.0__31bf3856ad364e35 \System.Web.Mvc.dll”和“c:\Users\majiang\AppData\Local\Temp\Temporary ASP.NET Files\root\7aaf28bd\6dc92822\assembly\dl3\7186f4ca\adb65958_7786cd01 \System.Web.Mvc.DLL”中
在 System.Web.Compilation.AssemblyBuilder.Compile()
在 System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
在 System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
在 System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
在 System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
在 System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound)
修改方案:
修改根目录下面的web.config,
当然也可以不用注释以上部分,把web.config中用到System.Web.Mvc的PublicKeyToken改为null就可以了
发表回复