0

I keep receiving this error below. I am not sure if there is a dependency I am supposed to install. Currently using Sitecore rocks to my VScode and when I create a Sitecore view layout and try to tie the layout to a template. It keeps crashing on the front end. Below is the error message I receive.

Error Rendering View: /Views/ClothingCo/Layouts/ViewLayout1.cshtml: Error while rendering view: '/Views/ClothingCo/Layouts/ViewLayout1.cshtml' (model: 'Sitecore.Mvc.Presentation.RenderingModel, Sitecore.Mvc').



at Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer)
   at Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Render(Renderer renderer, TextWriter writer, RenderRenderingArgs args) <br>
**Inner Exception: c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\0b19d496\e07ea606\App_Web_viewlayout1.cshtml.25717ab2.s2t-hr8u.0.cs(27): error CS0246: The type or namespace name 'SitecoreConnect' could not be found (are you missing a using directive or an assembly reference?)**<br>
   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.GetCompiledType(VirtualPath virtualPath)
   at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)
   at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData)
   at Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer)
2
  • Is it works with OOTB Sitecore Layout file? May 13 at 6:28
  • did you build your solution and published it because you are getting issue of modal it may be a case that your code is not published correctly. May 13 at 7:18

2 Answers 2

0

The error you are getting is because a type or namespace that is used in the csthml or code was not found. The reason can be that you might have forgotten to reference (References) the assembly that contains the type, or you might not have added the required using directive. Or, there might be an issue with the assembly you are trying to reference.

All these scenarios comes under that Compiler Error CS0246, that you are getting in your code.

  • You misspell the name of the type or namespace.
  • If the error is for a namespace name, the reference (References) you added to the assembly contains the namespace?
  • If the error is for a type name, did you include the proper using directive, or, alternatively, fully qualify the name of the type?
  • The assembly you referenced was built against a higher framework version than the target framework of the program.

All the things pointing to the Assembly that you are using is not correct. So you just need to verify that.

For more information, follow this link.

https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/cs0246

0

Check the error message: error CS0246: The type or namespace name 'SitecoreConnect' could not be found (are you missing a using directive or an assembly reference?)

It seems like the error comes from this namespace SitecoreConnect. I think this is a custom namespace that you must have used in your project. Try including this in the Views Web.config

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.