Assembly error after upgrade (10 to 11)

Sritam Patra asked on September 30, 2020 13:03

Hi guys,

Just looking for a little help, I have done an upgrade from v10 to v11 and everything went smoothly but when I try to run the local instance of the project I get the following error

Server Error in '/' Application.
Could not load file or assembly 'CMS.DataEngine, Version=10.0.0.0, Culture=neutral, PublicKeyToken=834b12a258******' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileLoadException: Could not load file or assembly 'CMS.DataEngine, Version=10.0.0.0, Culture=neutral, PublicKeyToken=834b12a258******' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Source Error:


Line 27:         // Initialize CMS application. This method should not be called from custom code.
Line 28:         //CMS.DataEngine.CMSHttpApplication.InitApplication();
Line 29:         InitApplication();
Line 30:     }
Line 31: 

Source File: E:\cinbell-kentico-full-repo\web\CMS\Global.asax.cs    Line: 29

Assembly Load Trace: The following information can be helpful to determine why the assembly 'CMS.DataEngine, Version=10.0.0.0, Culture=neutral, PublicKeyToken=834b12a258******' could not be loaded.


WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Stack Trace:


[FileLoadException: Could not load file or assembly 'CMS.DataEngine, Version=10.0.0.0, Culture=neutral, PublicKeyToken=834b12a258******' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
   System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type) +0
   System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +197
   System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) +166
   System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg) +156
   System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) +612
   System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType) +149
   System.Attribute.GetCustomAttributes(Assembly element, Type attributeType, Boolean inherit) +104
   System.Reflection.CustomAttributeExtensions.GetCustomAttributes(Assembly element) +58
   CMS.Core.TypeManager.PreInitializeTypes(Assembly assembly) +126
   CMS.Core.TypeManager.PreInitializeTypes() +281
   CMS.Core.ModuleEntryManager.PreInit() +19
   CMS.Core.AppCore.PreInit() +118
   CMS.DataEngine.CMSApplication.PreInit() +132
   CMS.DataEngine.CMSHttpApplication.InitApplication() +18
   Global..cctor() in E:\cinbell-kentico-full-repo\web\CMS\Global.asax.cs:29

[TypeInitializationException: The type initializer for 'Global' threw an exception.]
   Global..ctor() +0
   ASP.global_asax..ctor() in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\9ad39c1e\11f5c710\App_global.asax.l7ontmxd.0.cs:0

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
   System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +142
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +107
   System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +1476
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +186
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +28
   System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +82
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +174
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +347

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +552
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +122
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +737

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4075.0

I've tried many things such as deleting the IIS temp files but having no luck in getting the correct assemblies to be found. All the files in the /bin folder have been updated to v11. I checked individually and all the NuGet packages are uptodate also. so I'm a little stuck

Many thanks!

Sritam

Recent Answers


Brenden Kehren answered on September 30, 2020 13:54

After you upgraded did you do a clean and build on your project in Visual Studio?

Did you check your web.config for any manual bindings to dlls?

When you ran the upgrade did you get an upgrade complete message on the event log?

When you run the footing sql what results does it give you?

SELECT *
FROM CMS_SettingsKey
WHERE KeyName = 'CMSDataVersion' OR
KeyName = 'CMSDBVersion' OR
KeyName = 'CMSHotfixVersion'
0 votesVote for this answer Mark as a Correct answer

Sritam Patra answered on September 30, 2020 14:06

  1. Yes, After upgrade I clean and build my project in Visual Studio.

  2. Yes, I checked in web.config there is no manual binding of any dll .

  3. Yes, While upgrading the solution it was successfully completed and I confirmed from log file also.

  4. By executing the above SQL Query I got :

    CMSDataVersion : 10.0

    CMSDBVersion :11.0

    CMSHotfixVersion: 0

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on September 30, 2020 14:09

The results of your SQL query state your upgrade was not successful. I'd suggest taking back your code and database and trying again.

0 votesVote for this answer Mark as a Correct answer

Sritam Patra answered on October 1, 2020 07:51

Hi Brenden

I tried for 2 times but every time I am getting same as below. Can you tell me what am I missing before upgrading database.

output for your mentioned SQL Query.

CMSDataVersion : 10.0

CMSDBVersion :11.0

CMSHotfixVersion: 0

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on October 1, 2020 08:03

Before upgrading make sure your site is stopped. Also make sure you run your site after the upgrade attempt to access the admin site. If it times out, you'll need to keep trying to make sure that succeeds.

1 votesVote for this answer Mark as a Correct answer

Sritam Patra answered on October 1, 2020 09:27

Site is not live. It is not hosted. I am trying to upgrade my solution locally.

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on October 2, 2020 06:54

Do you launch the site after upgrading and do the first request to the /admin path? IS the Upgrade Start and Finish event logged in the Event log? From the above it looks like the upgrade never finished.
Moreover, if you are using any custom class library projects - e.g. scheduled tasks, event handlers, etc. Make sure these assembly classes have the references to Kentico DLLs refreshed too - you need to re-add the references to the new version of the DLLs.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.