Monday, December 20, 2010

SmartPart - unable to load ~\/UserControls\CustomControl.aspx in SharePoint. Could not load CustomControl.ascx


We had an issue with one of the custom controls hosted by the SmartPart (with AJAX).

The issue was:
  • A custom control was deployed to the "UserControls" folder under the portal's virtual directory.
  • Then a page was created and "SmartPart with AJAX" added to it.
  • In the SmaprtPart's properties section, under "User control to display:" drop-down it displayed "Could not load CustomControl.ascx".
  • I still selected the custom control from the drop-down and clicked on OK.
  • The control was added, but there was an error message
    Error: unable to load ~\/UserControls\CustomControl.ascx
    Details: c:\Inetpub\wwwroot\wss\VirtualDirectories\portal80\UserControls\CustomControl.ascx(6):
    error CS0023: Operator '--' cannot be applied to operand of type 'void'.
The cause of this error was the server-side comments section in the .ascx file:
<%--
            // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
            //This control is not used in other environments.
-- %>  

 As soon as this section was removed from the .ascx file, both the errors disappeared.The control appeared without errors in the drop-down and rendered fine on the page.

Monday, November 1, 2010

FatalError: The version of the package 12.0.10.0 is different from the current version this program supports, 14.0.0.0.


Recently I was performing a test migration of a site from MOSS to SharePoint 2010, using the stsadm export & import options.
The site contents were with all the versions & no file compression:
stsadm -o export -url "" -filename "" -versions 4 -nofilecompression

Then the site was imported into a blank SharePoint 2010 site:
stsadm -o import -url "" -filename "" -nofilecompression

The import process failed with following error:
FatalError: The version of the package 12.0.10.0 is different from the current version this program supports, 14.0.0.0.
Debug:    at Microsoft.SharePoint.Deployment.SPDeploymentSchemaVersion.Validate(SPSite site)
   at Microsoft.SharePoint.Deployment.SPImport.Run()
Progress: Import did not complete.


The culprit is the line:
<SchemaVersion Version="12.0.10.0" Build="12.0.0.6514" DatabaseVersion="476278" SiteVersion="0" />
in SystemData.xml.

Replace Version="12.0.0.0" with Version="14.0.0.0"
and Build="12.0.0.6514" with Version="14.0.4762.1000".

Here the build number "12.0.0.6514" is the MOSS version of the servere where the backup was performed and "14.0.4762.1000" is the build number of the SharePoint 2010 server where the import is being performed. Check the versions on both the export & import servers and replace the above values with the ones on your servers.

I edited the SystemData.xml file and ran the stsadm import process after that and it completed smoothly. There were a few errors and warnings, however, but those did not abort the process. If there is another critical error resulting in the import operation being aborted, look at the import.log file (in th folder where the site contents are being imported from) and there will be afair indication of what went wrong. This is the reason I export contents with the nofilecompression option, as it gives me the ability to have a look at the contents and find/rectify the cause of the errors.