Telerik.Sitefinity.Search.Impl error going from 7.1 to 7.3
I have a site using the code below.
Works fine on 7.1.5205. I now try to take the site up to 7.3.5619.0 and get the attached errors.
Anyone with an idea what I might be doing wronig?
Anything that has changed in the .dll?
Markus
I found this page
docs.sitefinity.com/api-changes-in-sitefinity-7-3
but don't know why this line would produce an error
protected global::Telerik.Sitefinity.Services.Search.Web.UI.Public.SearchBox bottomSearchBox;
Attached the whole custom search template
Markus
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace
SitefinityWebApp.CustomTemplates
public
partial
class
SearchResultsProducts
/// <summary>
/// topSearchBox control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected
global::Telerik.Sitefinity.Services.Search.Web.UI.Public.SearchBox topSearchBox;
/// <summary>
/// resultsStats control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected
global::Telerik.Sitefinity.Web.UI.SitefinityLabel resultsStats;
/// <summary>
/// resultsList control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected
global::System.Web.UI.WebControls.Repeater resultsList;
/// <summary>
/// pager control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected
global::Telerik.Sitefinity.Web.UI.Pager pager;
/// <summary>
/// bottomSearchBox control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected
global::Telerik.Sitefinity.Services.Search.Web.UI.Public.SearchBox bottomSearchBox;
using
System;
using
System.Linq;
using
System.Web.UI.WebControls;
using
Telerik.Sitefinity.Libraries.Model;
using
Telerik.Sitefinity.Modules.Pages;
using
Telerik.Sitefinity.Pages.Model;
using
Telerik.Sitefinity.Services.Search.Data;
using
DotNetImageControl = System.Web.UI.WebControls.Image;
using
Telerik.Sitefinity;
using
Telerik.Sitefinity.Model;
using
Telerik.Sitefinity.DynamicModules;
using
Telerik.Sitefinity.Data.Linq.Dynamic;
using
Telerik.Sitefinity.DynamicModules.Model;
using
Telerik.Sitefinity.GenericContent.Model;
using
Telerik.Sitefinity.Utilities.TypeConverters;
using
Telerik.Sitefinity.Security;
using
Telerik.Sitefinity.Lifecycle;
using
Telerik.Sitefinity.Modules.Libraries;
using
Telerik.Sitefinity.RelatedData;
namespace
SitefinityWebApp.CustomTemplates
public
partial
class
SearchResultsProducts : System.Web.UI.UserControl
protected
void
Page_Load(
object
sender, EventArgs e)
this
.resultsList.ItemDataBound += ResultsListItemDataBound;
// this.catalogManager = CatalogManager.GetManager();
this
.libMan = LibrariesManager.GetManager();
this
.pageMan = PageManager.GetManager();
this
.dynMan = DynamicModuleManager.GetManager();
void
ResultsListItemDataBound(
object
sender, RepeaterItemEventArgs e)
var myitem = e.Item.DataItem
as
IDocument;
if
(myitem !=
null
)
//You need to check for the type of the item you have gotten in your search results
var type = myitem.GetValue(
"ContentType"
);
var litera1lControl = e.Item.FindControl(
"Literal1"
)
as
Literal;
litera1lControl.Text = type.ToString();
//Documents enter the index with an Id field
if
(TypeResolutionService.ResolveType(type) ==
typeof
(Document))
var docItem = libMan.GetDocument(
new
Guid(myitem.GetValue(
"Id"
)));
var path = docItem.FilePath;
//Pages get in the index with OriginalItemId field
//Here's how you can display a page property in your search results
if
(TypeResolutionService.ResolveType(type) ==
typeof
(PageNode))
var ID =
new
Guid(myitem.GetValue(
"OriginalItemId"
));
//you can now get the item with its manager and access its properties,
//since you'll be working with an object of the correct type
//for example:
var page = pageMan.GetPageNode(ID);
if
(page !=
null
)
//check if the PageNode has PageData
if
(page.Page !=
null
)
//now you can simply get a control from your template and set the value to it,
//so it can be displayed
var literalControl = e.Item.FindControl(
"pageDescriptionLiteral"
)
as
Literal;
literalControl.Text = page.Page.Description;
//Retromarkt Objects, and Content items also enter the index with OriginalItemId field
var providerName = String.Empty;
DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager(providerName);
Type objektType = TypeResolutionService.ResolveType(
"Telerik.Sitefinity.DynamicTypes.Model.Retromarkt.Objekt"
);
// DynamicContent objektItem = dynamicModuleManager.CreateDataItem(objektType);
if
(TypeResolutionService.ResolveType(type) == objektType)
var ID =
new
Guid(myitem.GetValue(
"OriginalItemId"
));
//get the control that will display our data on the template
var image = e.Item.FindControl(
"productThumbnail"
)
as
DotNetImageControl;
//get the actual Product item
var objekt = DynamicModuleManager.GetManager().GetDataItem(objektType,ID);
if
(objekt !=
null
)
var hauptbild = objekt.GetRelatedItems<Telerik.Sitefinity.Libraries.Model.Image>(
"Hauptbild"
).FirstOrDefault();
var relativeUrl = hauptbild.ResolveThumbnailUrl(
"rm-cropped"
,
true
);
image.ImageUrl = relativeUrl;
////Products, and Content items also enter the index with OriginalItemId field
//if (TypeResolutionService.ResolveType(type) == typeof(Product))
//
// var ID = new Guid(myitem.GetValue("OriginalItemId"));
// //get the control that will display our data on the template
// var image = e.Item.FindControl("productThumbnail") as DotNetImageControl;
// //get the actual Product item
// var product = CatalogManager.GetManager().GetProduct(ID);
// if (product != null)
//
// //ste the property value to the control so it will be displayed on the frontend
// image.ImageUrl = product.PrimaryImageUrl;
//
//
//private CatalogManager catalogManager;
private
LibrariesManager libMan;
private
PageManager pageMan;
private
DynamicModuleManager dynMan;
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="~/CustomTemplates/SearchResultsProducts.ascx.cs" Inherits="SitefinityWebApp.CustomTemplates.SearchResultsProducts" %>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sitefinity" %>
<%@ Register Assembly="Telerik.Sitefinity.Search.Impl" Namespace="Telerik.Sitefinity.Services.Search.Web.UI.Public" TagPrefix="sfSearch" %>
<
sfSearch:SearchBox
ID
=
"topSearchBox"
runat
=
"server"
/>
<
sitefinity:SitefinityLabel
ID
=
"resultsStats"
runat
=
"server"
WrapperTagName
=
"p"
CssClass
=
"sfsearchResultStatistics"
Text="<%$Resources:SearchResources, SearchResultsStatusMessage %>" />
<
asp:Repeater
ID
=
"resultsList"
runat
=
"server"
>
<
HeaderTemplate
>
<
ul
class
=
"list-unstyled m-top-md m-bottom-md"
>
</
HeaderTemplate
>
<
ItemTemplate
>
<
li
class
=
"one-of-4 item-inline m-bottom-xl"
>
<
div
class
=
"thumbnail"
>
<
a
id
=
"A1"
runat
=
"server"
href='<%# Eval("Link")%>'> <
asp:Image
ID
=
"productThumbnail"
runat
=
"server"
CssClass
=
"rm-list-thumb"
/> </
a
> </
div
>
<
h3
class
=
"h4 m-top-md txt-overflow"
>
<
a
id
=
"A2"
runat
=
"server"
href='<%# Eval("Link")%>'> <%# Eval("Title") %></
a
>
</
h3
>
<
asp:Literal
ID
=
"Literal1"
runat
=
"server"
visible
=
"false"
/>
</
li
>
</
ItemTemplate
>
<
FooterTemplate
>
<%-- <
asp:PlaceHolder
ID
=
"ItemsContainer"
runat
=
"server"
/>--%>
</
ul
>
</
FooterTemplate
>
</
asp:Repeater
>
<
sitefinity:Pager
ID
=
"pager"
runat
=
"server"
/>
<
sfSearch:SearchBox
ID
=
"bottomSearchBox"
runat
=
"server"
/>
Hello
We have answered you in the support ticket.
Feel free to share the information with the community.
Regards,
Nikola Zagorchev
Telerik
Unfortunately the answer in the support ticked did not help.
I created a new project and simply added the .ascx and get the error :-(
www.marktold.com/screencast/search-problem-on-new-project.swf
Any idea why this could happen is appreciated.
Markus
Markus,
Try to remove the following lines from the designer.cs file:
protected global::Telerik.Sitefinity.Services.Search.Web.UI.Public.SearchBox topSearchBox;
protected global::Telerik.Sitefinity.Services.Search.Web.UI.Public.SearchBox bottomSearchBox;
However, you have to keep your controls (sfSearch:SearchBox) in your ASCX.
Thanks,
Trung
I am having the same problem. Just upgraded from 7.2 to 7.3 and the search template compiled just fine until I added Thunder to the project. After adding thunder I received compile errors and had to remove the custom search template. Removing those lines from the designer caused problems in the controller.
Hi Justin,
Removing these lines in your designer.cs file makes VS build the solution successfully. However, please make sure that you still have <sfSearch:SearchBox tags in your ascx file because these controls will be accessed in SF's code (I guess they find these controls by ID).
Hope that works for you.
Trung
Hi,
As suggested by Trung, you can try removing the designer class and building.
You can also try setting the project on a different environment.
Regards,
Nikola Zagorchev
Telerik
Hi,
I am running into the same problem with upgrade from 6.0 to 8.0. I have used custom search box and searchResults page and I am running into the same problem.
As suggested in this post, I removed following line from my designer file which eliminate some of the errors.
protected global::Telerik.Sitefinity.Services.Search.Web.UI.Public.SearchBox searchBox1;
But SearchResults page is inheriting Telerik.Sitefinity.Services.Search.Web.UI.Public.SearchResults where it generates error that "The type or namespace name 'Web' does not exist in the namespace 'Telerik.Sitefinity.Services.Search' (are you missing an assembly reference?)".
Did anyone else run into this problem as well?
Thanks
Atit
Hi Atit,
Could you please check whether you have updated your web.config with the assembly bindings from 8.0:
<
runtime
>
<
assemblyBinding
xmlns
=
"urn:schemas-microsoft-com:asm.v1"
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"Newtonsoft.Json"
publicKeyToken
=
"30ad4fe6b2a6aeed"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-6.0.0.0"
newVersion
=
"6.0.0.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"System.Runtime"
publicKeyToken
=
"b03f5f7f11d50a3a"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-2.6.8.0"
newVersion
=
"2.6.8.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"System.Threading.Tasks"
publicKeyToken
=
"b03f5f7f11d50a3a"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-2.6.8.0"
newVersion
=
"2.6.8.0"
/>
</
dependentAssembly
>
</
assemblyBinding
>
</
runtime
>
Hi Nicola,
I added binding for Newtonsoft.Json as per your above code snippet, but other 2 were already there. I am still getting the same error.
The warning message I see at compile time says it is looking for version 1.5.11.o for System.Runtime (not 2.6.8.0). Not sure if this is causing the problem. Also, I have copied all assembly bindings I have in my code.
01.
<
dependentAssembly
>
02.
<
assemblyIdentity
name
=
"System.Runtime"
publicKeyToken
=
"b03f5f7f11d50a3a"
culture
=
"neutral"
/>
03.
<
bindingRedirect
oldVersion
=
"0.0.0.0-2.6.8.0"
newVersion
=
"2.6.8.0"
/>
04.
</
dependentAssembly
>
05.
<
dependentAssembly
>
06.
<
assemblyIdentity
name
=
"Newtonsoft.Json"
publicKeyToken
=
"30ad4fe6b2a6aeed"
culture
=
"neutral"
/>
07.
<
bindingRedirect
oldVersion
=
"0.0.0.0-6.0.0.0"
newVersion
=
"6.0.0.0"
/>
08.
</
dependentAssembly
>
09.
<
dependentAssembly
>
10.
<
assemblyIdentity
name
=
"Telerik.Sitefinity.Utilities"
publicKeyToken
=
"b28c218413bdf563"
culture
=
"neutral"
/>
11.
<
bindingRedirect
oldVersion
=
"0.0.0.0-8.0.5710.0"
newVersion
=
"8.0.5710.0"
/>
12.
</
dependentAssembly
>
13.
<
dependentAssembly
>
14.
<
assemblyIdentity
name
=
"Telerik.Web.UI"
publicKeyToken
=
"121fae78165ba3d4"
culture
=
"neutral"
/>
15.
<
bindingRedirect
oldVersion
=
"0.0.0.0-2015.1.225.40"
newVersion
=
"2015.1.225.40"
/>
16.
</
dependentAssembly
>
17.
<
dependentAssembly
>
18.
<
assemblyIdentity
name
=
"Telerik.OpenAccess.Web"
publicKeyToken
=
"7ce17eeaf1d59342"
culture
=
"neutral"
/>
19.
<
bindingRedirect
oldVersion
=
"0.0.0.0-2015.1.225.1"
newVersion
=
"2015.1.225.1"
/>
20.
</
dependentAssembly
>
21.
<
dependentAssembly
>
22.
<
assemblyIdentity
name
=
"Telerik.Sitefinity.Services.Notifications"
publicKeyToken
=
"b28c218413bdf563"
culture
=
"neutral"
/>
23.
<
bindingRedirect
oldVersion
=
"0.0.0.0-8.0.5710.0"
newVersion
=
"8.0.5710.0"
/>
24.
</
dependentAssembly
>
25.
<
dependentAssembly
>
26.
<
assemblyIdentity
name
=
"Telerik.Sitefinity.Services.Statistics"
publicKeyToken
=
"b28c218413bdf563"
culture
=
"neutral"
/>
27.
<
bindingRedirect
oldVersion
=
"0.0.0.0-8.0.5710.0"
newVersion
=
"8.0.5710.0"
/>
28.
</
dependentAssembly
>
29.
<
dependentAssembly
>
30.
<
assemblyIdentity
name
=
"Telerik.Sitefinity.Services.Documents"
publicKeyToken
=
"b28c218413bdf563"
culture
=
"neutral"
/>
31.
<
bindingRedirect
oldVersion
=
"0.0.0.0-8.0.5710.0"
newVersion
=
"8.0.5710.0"
/>
32.
</
dependentAssembly
>
33.
<
dependentAssembly
>
34.
<
assemblyIdentity
name
=
"Telerik.Sitefinity.Search"
publicKeyToken
=
"b28c218413bdf563"
culture
=
"neutral"
/>
35.
<
bindingRedirect
oldVersion
=
"0.0.0.0-8.0.5710.0"
newVersion
=
"8.0.5710.0"
/>
36.
</
dependentAssembly
>
37.
<
dependentAssembly
>
38.
<
assemblyIdentity
name
=
"Telerik.Sitefinity.Personalization"
publicKeyToken
=
"b28c218413bdf563"
culture
=
"neutral"
/>
39.
<
bindingRedirect
oldVersion
=
"0.0.0.0-8.0.5710.0"
newVersion
=
"8.0.5710.0"
/>
40.
</
dependentAssembly
>
41.
<
dependentAssembly
>
42.
<
assemblyIdentity
name
=
"Microsoft.WindowsAzure.Diagnostics"
publicKeyToken
=
"31bf3856ad364e35"
culture
=
"neutral"
/>
43.
<
bindingRedirect
oldVersion
=
"0.0.0.0-2.2.0.0"
newVersion
=
"2.2.0.0"
/>
44.
</
dependentAssembly
>
45.
<
dependentAssembly
>
46.
<
assemblyIdentity
name
=
"System.Web.Helpers"
publicKeyToken
=
"31bf3856ad364e35"
culture
=
"neutral"
/>
47.
<
bindingRedirect
oldVersion
=
"0.0.0.0-1.0.0.0"
newVersion
=
"1.0.0.0"
/>
48.
</
dependentAssembly
>
49.
<
dependentAssembly
>
50.
<
assemblyIdentity
name
=
"System.Threading.Tasks"
publicKeyToken
=
"b03f5f7f11d50a3a"
culture
=
"neutral"
/>
51.
<
bindingRedirect
oldVersion
=
"0.0.0.0-2.6.8.0"
newVersion
=
"2.6.8.0"
/>
52.
</
dependentAssembly
>
53.
<
dependentAssembly
>
54.
<
assemblyIdentity
name
=
"Telerik.Windows.Documents.Core"
publicKeyToken
=
"5803cfa389c90ce7"
culture
=
"neutral"
/>
55.
<
bindingRedirect
oldVersion
=
"0.0.0.0-2013.1.415.40"
newVersion
=
"2013.1.415.40"
/>
56.
</
dependentAssembly
>
57.
</
assemblyBinding
>
I hope this information helps with some diagnosis.
Thanks
Atit
Hello
We have addressed the issue on this forum thread specifically opened for the issue you are facing:
http://www.sitefinity.com/developer-network/forums/general-discussions-/sitefinity-8-0-upgrade-causing-issues-with-missing-assembly-reference
We will also handle the problem in your support ticket. Please, feel free to share the resolution to it with the community.
Regards,
Nikola Zagorchev
Telerik
Hi All,
Probably this may save couple of hours for someone else. I was able to solve the problem by updating .csproj file to match as per the new 8.0 project. I had to add couple of lines from blank project to my existing project to get it to work..
Thanks
Atit
Hello Atit,
Thank you for sharing this with the community.
Regards,
Nikola Zagorchev
Telerik