A Step Ahead: Troubleshooting Common Errors - Part I

Many a times we get customers’ issues asking for the resolution of some design, assemblies and license related problems. Lets discuss few common scenarios and their solutions here which would help in times when you face these issues.

Could not load file or assembly 'C1.Win.C1Ribbon.4, Version=4.0.20131.440, Culture=neutral, PublicKeyToken=79882d576c6336da' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Sometimes after upgrading your WinForms projects containing ComponentOne controls you may get this error. It occurs because there still exists a reference to an older version of a C1 control (for example, C1Ribbon here) in the project. CouldNotLoad Solution 1 Unblock the control’s dll and then try using it in your application. To unblock the dll, right click on the dll and select 'Properties'. In the 'General' tab of the Properties, select the 'Unblock' option. Unblock Solution 2

  1. Delete the old references from the References tab in Solution Explorer.
  2. Delete the licenses.licx file and clean the solution.
  3. Close Solution and Close VS because at times VS has some weird behavior to keep the cache to hold dll references.
  4. Delete bin and obj folders from application folder.
  5. Open VS and check application's framework- it should not be Client Profile version.
  6. Add a new Form.
  7. And then drag drop all the controls ( of the latest version) being used in your application. This will create licenses.licx file along with adding references in the solution explorer References tab.
  8. Rebuild the project. And it should work.

Also, check the specific control’s dll version in GAC. It should be the same version which you want to use in your application.

'Failed to Create Component' Design Time Exception

If you have changed the versions of Studio for WinForms assemblies you may have encountered this exception. It is caused when you have referenced C1 assemblies in your project versioned different than the ones in your Toolbox. E.g Your project references 2014 V1 while in your toolbox you have 2015 V1. When you drag an item from the Toolbox Visual Studio automatically attempts to add references to your project needed for the dragged component. However, since you already have this assembly referenced, but with different version, exception is thrown. FailedToCreate Solution First thing first, you should know what versions are your assemblies. To see the version of the items in the Visual Studio Toolbox, move your mouse over any control of Studio for WinForms and a tool tip with the version information will appear. To get the version of your referenced assemblies you should expand the References of your project, click any dll and press F4, this will display the property window which contains information about the version of the file. Basically you need to make both versions of the assemblies match. To do the same, there are a few options:

  1. Remove all versions of C1 assemblies from your computer and install just the latest one. Then update your project references to this particular version. This should fix all issues by replacing the assemblies in your GAC and Toolbox.
  2. Update the items in your Toolbox to the latest version installed on the machine.
  3. Change the referenced assemblies in your project to match the ones in your Toolbox.

Controls are not loaded at Design Time

After you update to a new version of the Studio for WinForms, you start seeing C1 controls in the component tray and you are not able to select them on the Form. Otherwise, you see errors as in the image below wherein, clicking 'Ignore and Continue' option removes all controls from the Form. ControlsNotLoaded Solution 1 The design-time layouts of WinForms controls are implemented in their Design dlls. If the WinForms suite is installed on the machine using the installer, these assemblies are automatically installed in the Global Assemly Cache. If you upgrade your controls using C1Live, then also the Design dlls are placed correctly in GAC. However, if you decide to upgrade assembly references manually by downloading the files that contains assemblies only, please be aware that these two approaches do not install the Design assembly in your GAC automatically. So, to resolve this case, you should simply install the Design dlls manually in your GAC. These Design dlls are shipped with every release build of WinForms assemblies which you might have downloaded. If this still does not resolve the issue, please make sure that all references to C1 assemblies point to the latest version installed on the machine. Solution 2 Just copy the same version of Design dll which you are using in the application, to folder where Visual Studio "devenv.exe" file exists. E.g. For VS.2010 --> C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE Close and open Visual Studio then. The issue will be resolved. For more tips on such issues, stay tuned...Blogs :)


GrapeCity Developer Tools
comments powered by Disqus