Could not load type Umbraco.Web.Models.Trees.MenuItem from assembly umbraco
I'm in the process of updating an Umbraco 4.7.1.1 site to 6.2.0 (RC for now). Upgrading went smooth, but after i built some additional controls that are used in this site, I got this server error when accessing the site, or the umbraco backend.
When I browse this umbraco assembly (1.0.5192.31515, located in the bin folder), I cannot locate this referred type either, but what am I missing?
Could not load type 'Umbraco.Web.Models.Trees.MenuItem' from assembly 'umbraco, Version=1.0.5192.31515, Culture=neutral, PublicKeyToken=null'. 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.TypeLoadException: Could not load type 'Umbraco.Web.Models.Trees.MenuItem' from assembly 'umbraco, Version=1.0.5192.31515, Culture=neutral, PublicKeyToken=null'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
The controls you're building - are they hooking into the Umbraco API's? Then you should probably remove the referenced umbraco.dll's and add them again but this time from your 6.2.0 installation - And then be aware that the API's have changed since 4.7 so perhaps you need to change something in your custom code in order to have something working.
Ok...do you have some code that could be shared perhaps? And have you had a look at the /app_data/logs file to see if some more information is revealed?
What I did is replaced the umbraco.dll assemby from 7.1.0 RC and the error disappeared Leading to the next message: Could not load type 'Umbraco.Core.Models.Membership.MembershipScenario' from assembly 'Umbraco.Core,
Replaced that as well with the umbraco.Core.dll assembly from 7.1.0 leading to the next message: Could not load types from assembly umbraco, Version=1.0.5192.30601, Culture=neutral, PublicKeyToken=null, errors: Exception: System.IO.FileNotFoundException: Could not load file or assembly 'AutoMapper, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. File name: 'AutoMapper, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null'
Off course I could go this way, but I doubt this is the right way. The issue started when I started using the new API's (using ApplicationContext.Current.Services.XyzService)
Just rolled back my changes, not making use of any of the new API's.
Just added a reference to Umbraco.Core and built the solution, but the same error pops up: Could not load type 'Umbraco.Web.Models.Trees.MenuItem' from assembly 'umbraco, Version=1.0.5192.31515, Culture=neutral, PublicKeyToken=null'.
I stopped continuing this trial-on-error path, and I took a more solid approach in upgrading (I think). Since the solution depends on various 3rd party umbraco plugins, I decided to uninstall these prior to upgrading (Courier, CourierContrib, MediaProtect, TaskSchedulre) and install the current versions afterwards.
Instead of copying all newer files to the existing version, I started with new 6.2.0 version and merged all changes that needed merging from the old to the new version (assemblies containing my usercontrols, controls and custom code, umbraco/config/*.config, umbraco/app_data/*.config, css, scripts, masterpages, usercontrols, macroscripts).
So far so good, got the backend and frontend up and running and start to refactor obsoleted code.
Could not load type Umbraco.Web.Models.Trees.MenuItem from assembly umbraco
I'm in the process of updating an Umbraco 4.7.1.1 site to 6.2.0 (RC for now). Upgrading went smooth, but after i built some additional controls that are used in this site, I got this server error when accessing the site, or the umbraco backend.
When I browse this umbraco assembly (1.0.5192.31515, located in the bin folder), I cannot locate this referred type either, but what am I missing?
Could not load type 'Umbraco.Web.Models.Trees.MenuItem' from assembly 'umbraco, Version=1.0.5192.31515, Culture=neutral, PublicKeyToken=null'.
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.TypeLoadException: Could not load type 'Umbraco.Web.Models.Trees.MenuItem' from assembly 'umbraco, Version=1.0.5192.31515, Culture=neutral, PublicKeyToken=null'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[TypeLoadException: Could not load type 'Umbraco.Web.Models.Trees.MenuItem' from assembly 'umbraco, Version=1.0.5192.31515, Culture=neutral, PublicKeyToken=null'.]
System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes) +0
System.Reflection.RuntimeAssembly.GetExportedTypes() +49
Umbraco.Core.TypeFinder.GetTypesWithFormattedException(Assembly a) +128
Umbraco.Core.TypeFinder.GetClasses(Type assignTypeFrom, IEnumerable`1 assemblies, Boolean onlyConcreteClasses, Func`2 additionalFilter) +520
Umbraco.Core.TypeFinder.GetClasses(Type assignTypeFrom, IEnumerable`1 assemblies, Boolean onlyConcreteClasses, Func`2 additionalFilter) +1335
Umbraco.Core.PluginManager.LoadViaScanningAndUpdateCacheFile(TypeList typeList, TypeResolutionKind resolutionKind, Func`1 finder) +53
Umbraco.Core.PluginManager.ResolveTypes(Func`1 finder, TypeResolutionKind resolutionType, Boolean cacheResult) +1942
Umbraco.Core.PluginManager.ResolveTypes(Boolean cacheResult, IEnumerable`1 specificAssemblies) +183
Umbraco.Web.WebBootManager.InitializeApplicationEventsResolver() +35
Umbraco.Core.CoreBootManager.Initialize() +438
Umbraco.Web.WebBootManager.Initialize() +55
Umbraco.Core.UmbracoApplicationBase.StartApplication(Object sender, EventArgs e) +122
[HttpException (0x80004005): Could not load type 'Umbraco.Web.Models.Trees.MenuItem' from assembly 'umbraco, Version=1.0.5192.31515, Culture=neutral, PublicKeyToken=null'.]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +12951429
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +175
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +304
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +404
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +475
[HttpException (0x80004005): Could not load type 'Umbraco.Web.Models.Trees.MenuItem' from assembly 'umbraco, Version=1.0.5192.31515, Culture=neutral, PublicKeyToken=null'.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12968436
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12808141
Hi Marchel
The controls you're building - are they hooking into the Umbraco API's? Then you should probably remove the referenced umbraco.dll's and add them again but this time from your 6.2.0 installation - And then be aware that the API's have changed since 4.7 so perhaps you need to change something in your custom code in order to have something working.
You can see some API documentation here http://our.umbraco.org/documentation/Reference/
Hope this helps!
Cheers, Jan
Thanks for your prompt response Jan!
They are indeed hooking into the new API's. The reason for rebuilding was actually that I refactored these controls to use the new API's.
I did remove and re-add the reference to the umbraco.dll assembly and I verified the version I'm referring to (1.0.5192.31515).
Hi Macelh
Ok...do you have some code that could be shared perhaps? And have you had a look at the /app_data/logs file to see if some more information is revealed?
/Jan
Well, there is a lot, actually.
What I did is replaced the umbraco.dll assemby from 7.1.0 RC and the error disappeared
Leading to the next message:
Could not load type 'Umbraco.Core.Models.Membership.MembershipScenario' from assembly 'Umbraco.Core,
Replaced that as well with the umbraco.Core.dll assembly from 7.1.0 leading to the next message:
Could not load types from assembly umbraco, Version=1.0.5192.30601, Culture=neutral, PublicKeyToken=null, errors:
Exception: System.IO.FileNotFoundException: Could not load file or assembly 'AutoMapper, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'AutoMapper, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null'
Off course I could go this way, but I doubt this is the right way. The issue started when I started using the new API's (using ApplicationContext.Current.Services.XyzService)
Just rolled back my changes, not making use of any of the new API's.
Just added a reference to Umbraco.Core and built the solution, but the same error pops up: Could not load type 'Umbraco.Web.Models.Trees.MenuItem' from assembly 'umbraco, Version=1.0.5192.31515, Culture=neutral, PublicKeyToken=null'.
I stopped continuing this trial-on-error path, and I took a more solid approach in upgrading (I think). Since the solution depends on various 3rd party umbraco plugins, I decided to uninstall these prior to upgrading (Courier, CourierContrib, MediaProtect, TaskSchedulre) and install the current versions afterwards.
Instead of copying all newer files to the existing version, I started with new 6.2.0 version and merged all changes that needed merging from the old to the new version (assemblies containing my usercontrols, controls and custom code, umbraco/config/*.config, umbraco/app_data/*.config, css, scripts, masterpages, usercontrols, macroscripts).
So far so good, got the backend and frontend up and running and start to refactor obsoleted code.
is working on a reply...