Asp.net mvc 3 &引用;内核&x27;命名空间中不存在';Sitecore&x27;

Asp.net mvc 3 &引用;内核&x27;命名空间中不存在';Sitecore&x27;,asp.net-mvc-3,namespaces,kernel,sitecore,Asp.net Mvc 3,Namespaces,Kernel,Sitecore,遇到一个奇怪的Sitecore错误。使用MVC将Sitecore 6.6中的布局应用于两个不同的内容项,我发现以下错误: c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\95ad0ba4\20f230f7\App_Web__sitecorelayout.cshtml.5d96958d.682ppzj_.0.cs(24): error CS0234: The type or namespace

遇到一个奇怪的Sitecore错误。使用MVC将Sitecore 6.6中的布局应用于两个不同的内容项,我发现以下错误:

c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\95ad0ba4\20f230f7\App_Web__sitecorelayout.cshtml.5d96958d.682ppzj_.0.cs(24): error CS0234: The type or namespace name 'Kernel' does not exist in the namespace 'Sitecore' (are you missing an assembly reference?)

System.Web.HttpCompileException (0x80004005): c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\95ad0ba4\20f230f7\App_Web__sitecorelayout.cshtml.5d96958d.682ppzj_.0.cs(24): error CS0234: The type or namespace name 'Kernel' does not exist in the namespace 'Sitecore' (are you missing an assembly reference?)
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.Mvc.BuildManagerWrapper.System.Web.Mvc.IBuildManager.FileExists(String virtualPath)
at System.Web.Mvc.VirtualPathProviderViewEngine.GetPathFromSpecificName(ControllerContext controllerContext, String name, 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.FindPartialView(ControllerContext controllerContext, String partialViewName, Boolean useCache)
at System.Web.Mvc.ViewEngineCollection.Find(Func`2 lookup, Boolean trackSearchedPaths)
at System.Web.Mvc.HtmlHelper.FindPartialView(ViewContext viewContext, String partialViewName, ViewEngineCollection viewEngineCollection)
at System.Web.Mvc.HtmlHelper.RenderPartialInternal(String partialViewName, ViewDataDictionary viewData, Object model, TextWriter writer, ViewEngineCollection viewEngineCollection)
at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData)
at Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer)
at Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Render(Renderer renderer, TextWriter writer, RenderRenderingArgs args)
at Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Process(RenderRenderingArgs args)
at (Object , Object[] )
at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
at Sitecore.Mvc.Pipelines.PipelineService.RunPipeline[TArgs](String pipelineName, TArgs args)
at Sitecore.Mvc.Presentation.RenderingView.Render(ViewContext viewContext, TextWriter writer)
at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1c.b__19()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\95ad0ba4\20f230f7\App\u Web\uu sitecorelayout.cshtml.5d96958d.682ppzj\u0.cs(24):错误CS0234:命名空间“Sitecore”中不存在类型或命名空间名称“Kernel”(是否缺少程序集引用?)
System.Web.HttpCompileeException(0x80004005):c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\95ad0ba4\20f230f7\App\u Web\uu sitecorelayout.cshtml.5d96958d.682ppzj\u0.cs(24):错误CS0234:命名空间“Sitecore”中不存在类型或命名空间名称“Kernel”(是否缺少程序集引用?)
在System.Web.Compilation.AssemblyBuilder.Compile()中
在System.Web.Compilation.BuildProvidersCompiler.PerformBuild()中
位于System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath VirtualPath)
位于System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath、Boolean noBuild、Boolean allowCrossApp、Boolean allowBuildInPrecompile、Boolean throwIfNotFound、Boolean EnsureUpdate)
在System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext上下文、VirtualPath VirtualPath、Boolean noBuild、Boolean allowCrossApp、Boolean allowBuildInPrecompile、Boolean throwIfNotFound、Boolean EnsureUpdate)
位于System.Web.Compilation.BuildManager.GetVirtualPath对象工厂(VirtualPath VirtualPath、HttpContext上下文、布尔allowCrossApp、布尔throwIfNotFound)
位于System.Web.Mvc.buildmanagerRapper.System.Web.Mvc.IBuildManager.FileExists(字符串virtualPath)
位于System.Web.Mvc.VirtualPathProviderViewEngine.GetPathFromSpecificName(ControllerContext ControllerContext、String name、String cacheKey、String[]和searchedLocations)
位于System.Web.Mvc.VirtualPathProviderViewEngine.GetPath(ControllerContext ControllerContext,String[]位置,String[]区域位置,String locationsPropertyName,String name,String controllerName,String cacheKeyPrefix,Boolean useCache,String[]和searchedLocations)
位于System.Web.Mvc.VirtualPathProviderViewEngine.FindPartialView(ControllerContext ControllerContext、String partialViewName、Boolean useCache)
在System.Web.Mvc.ViewEngineCollection.Find(Func`2查找,布尔跟踪搜索路径)
在System.Web.Mvc.HtmlHelper.FindPartialView(ViewContext ViewContext,String partialViewName,ViewEngineCollection ViewEngineCollection)中
位于System.Web.Mvc.HtmlHelper.RenderPartialInternal(字符串partialViewName、ViewDataDictionary viewData、对象模型、TextWriter编写器、ViewEngineCollection ViewEngineCollection)
位于System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper HtmlHelper、字符串partialViewName、对象模型、ViewDataDictionary viewData)
在Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter)中
位于Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Render(渲染器渲染器、TextWriter编写器、渲染器渲染器args args)
在Sitecore.Mvc.Pipelines.Response.RenderRenderRendering.ExecuteRenderer.Process(RenderRenderRenderingArgs args)中
at(对象,对象[])
在Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
位于Sitecore.Mvc.Pipelines.PipelineService.RunPipeline[TArgs](字符串pipelineName,TArgs args)
在Sitecore.Mvc.Presentation.RenderingView.Render(ViewContext、ViewContext、TextWriter)上
在System.Web.Mvc.ViewResultBase.ExecuteSult(ControllerContext上下文)中
在System.Web.Mvc.ControllerActionInvoker.c_uuDisplayClass1C.b_uuu19()中
位于System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter筛选器、ResultExecutingContext预文本、Func`1 continuation)
位于System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter筛选器、ResultExecutingContext预文本、Func`1 continuation)
位于System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext ControllerContext,IList`1 filters,ActionResult ActionResult)
位于System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext ControllerContext,String actionName)

IIS中的构建和应用程序池设置为4框架。我不知所措。同一场景中的任何人是否也发生过这种情况?

因为它是动态编译的,也许您可以将sitecore DLL复制到临时ASP.NET文件夹中,因为很明显,当您正在编译且未运行时,会发生错误,因此bin中不会出现问题?不过只是猜测而已


如果不起作用,请检查版本或尝试删除临时ASP.NET文件夹中的所有内容,然后重试。

问题是由于在视图目录的web.config文件的名称空间部分添加了Sitecore.Kernel名称空间。解决了这个问题


与Sitecore支持部门合作解决此问题。大约半小时前我才发现。

我也有同样的问题。右键单击引用文件夹->添加引用->浏览->从您的bin文件夹中选择Sitecore.Kernel(在您的项目中)->再次构建解决方案。

我的问题是目标框架。当我收到这个问题时,我在.NET4.5上。我升级到.NET 4.6,问题消失了。

Sitecore.Kernel.dll是否在您的bin目录中?是的,它在bin目录中。