SF search in ~/Views for *.cshtml files intead of ~/MVC/View

Posted by Community Admin on 05-Aug-2018 19:44

SF search in ~/Views for *.cshtml files intead of ~/MVC/Views

All Replies

Posted by Community Admin on 05-Jul-2016 00:00

I am running into this issue from time to time ... both if the widgets are in an external project/assembly (with the *.cshtml marked as embed)  and creating SF widgets in the MVC  folder of the SitefinityWebApp ...................

 

I get a run time error that cannot find the views under the regular Mvc "Views" folder even though they are under Mvc/Views 

 

For the time being I am just duplicating what is in Mvc/Views to Views .... and feedback would be appreciated as  this defeats the purpose of  keeping the widgets in an external assembly

 

 

 

 

~/Views/LogoBar/Default.cshtml
~/Views/Shared/Default.cshtml
~/Views/LogoBar/Default.aspx
~/Views/LogoBar/Default.ascx
~/Views/Shared/Default.aspx
~/Views/Shared/Default.ascx
~/Views/LogoBar/Default.vbhtml
~/Views/Shared/Default.vbhtml
Source : System.Web.Mvc
Help link : 
Data : System.Collections.ListDictionaryInternal
TargetSite : System.Web.Mvc.ViewEngineResult FindView(System.Web.Mvc.ControllerContext)
HResult : -2146233079
Stack Trace :    at System.Web.Mvc.ViewResult.FindView(ControllerContext context)
   at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)
   at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
   at Telerik.Sitefinity.Mvc.ControllerWrapper.Execute()
   at Telerik.Sitefinity.Mvc.ControllerActionInvoker.ExecuteController(MvcProxyBase proxyControl)
   at Telerik.Sitefinity.Frontend.Mvc.Infrastructure.Routing.FeatherActionInvoker.ExecuteController(MvcProxyBase proxyControl)

Posted by Community Admin on 07-Jul-2016 00:00

We are having the same problem if we add our widgets to the SitefinityWebApp project instead of an external library project

Posted by Community Admin on 11-Jul-2016 00:00

Hi,

Please try adding the ControllerContainer specification to the SitefinityWebApp's AssemblyInfo file as described in the following documentation article: http://docs.sitefinity.com/feather-create-widgets#create-the-custom-model-the-controller-and-the-view

Regards,
Velizar Bishurov
Telerik by Progress

 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

Posted by Community Admin on 21-Jul-2016 00:00

Hi,

I also have this issue and have the line:

[assembly: Telerik.Sitefinity.Frontend.Mvc.Infrastructure.Controllers.Attributes.ControllerContainer]

in AssemblyInfo.cs file.

Can you suggest any other possible solutions?

Posted by Community Admin on 26-Jul-2016 00:00

HI, Can you please provide a bit more details about your case. For example where are the views located - in the SitefinityWebApp or in an external assembly? If they are in an external assembly is their build type set to Embedded resource? Does the external assembly's AssemblyInfo have the ControllerSpecification? Also, if possible, please provide us with the entire error that you are seeing so we can get a bigger picture of the problem. Regards, Velizar

Posted by Community Admin on 28-Jul-2016 00:00

I resolved this issue in my case by fixing the namespace of the MVC controllers. For historical reasons the namespace did not match the expected name for the assembly and this was causing the issue.

Posted by Community Admin on 28-Jul-2016 00:00

Hi, It is good to see you were able to resolve the issue. On a side note it is possible to have controllers in a non-default namespace by registering a custom ViewEngine as described in the following KB article: knowledgebase.progress.com/.../MVC-Add-new-view-engine-to-Sitefinity Regards, Velizar

This thread is closed