Error: ESRI.ArcGIS.ADF.Web.UI.WebControls.BuddyControlCollection must have items of type ESRI.ArcGIS.ADF.Web.UI.WebControls.BuddyControl
After installing version 9.3 of the ArcGIS Server .NET Web ADF and modifying a Web application created with version 9.2, building the Web site in Visual Studio can return one of the following errors:
Message # 1
must have items of type
'esri.arcgis.adf.web.ui.webcontrols.buddycontrol' is of type
Message # 2
must have items of type
'esri.arcgis.adf.web.ui.webcontrols.mapresourceitem' is of type
Error message #2 is specific to the MapResourceManager. The GeoprocessingResourceManager and GeocodeResourceManager controls return slightly different messages that refer to 'GeoprocessingResourceItem' and 'GeocodeResourceItem' respectively.
The problem occurs because the web.config file of the application contains references to version 9.2 Web ADF and ArcObjects assemblies, but the installed versions of these assemblies are version 9.3. Though publisher policy files are in place to direct applications created with the ArcGIS Server 9.2 Web ADF to use the newer version 9.3 assemblies, Visual Studio does not respect this due to a bug.
Visual Studio Designer not Respecting Assembly Binding Redirection.
When editing a property for a Web ADF control, incorrect markup gets inserted into the page, causing these errors. The incorrect markup can be found by looking at the source code view of the ASPX page.
The problem only happens when editing a control that contains child elements. Examples of controls that use child elements are the MapResourceManager, Search or Query tasks, and the Toolbar.
Solution or Workaround
If there are version 9.2-based Web ADF applications that need to be used with version 9.3, before editing anything in the project, update the assembly version numbers referenced in the Web application to 22.214.171.1240.
The following steps describe how to update the applications to version 126.96.36.1990 as well as how to fix the incorrect markup.
- Update the assembly version numbers referenced in the Web application to 188.8.131.520.
a) Select Edit > Find and Replace > Find in Files and configure the dialog as seen below.
b) Select to replace all of the occurrences of version 9.2.x.x with 184.108.40.2060 in the solution. The regular expression can be copied from below:
- Fix the corrupted markup in the ASPX files.
a) Right-click the ASPX file in the Solution Explorer. Select View Markup.
b) Depending on the control that was modified, replace the following strings with the correct values.
If the Search Attributes, Query Attributes, Geoprocessing, Find Address, or Find Place task was modified, correct the following string.
If the Toolbar control was modified, correct the following two strings.
If the MapResourceManager was modified, correct the following string.
If the GeocodeResourceManager was modified, correct the following string.
If the GeoprocessingResourceManager was modified, correct the following string.