I need to switch a specific library that was from version 16.1 before to version 15.0. I did this by removing the higher version and installing the lower version by nuget.
When building, the correct dll (15.0) is created in the bin-directory. But I receive the following error when starting the (web) application:
[FileLoadException: Could not load file or assembly 'Microsoft.SharePoint.Client.Runtime, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' 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) +145
System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) +158
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) +91
System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) +438
System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType) +103
System.Reflection.RuntimeAssembly.GetCustomAttributes(Boolean inherit) +37
Owin.Loader.DefaultLoader.SearchForStartupAttribute(String friendlyName, IList`1 errors, Boolean& conflict) +106
Owin.Loader.DefaultLoader.GetDefaultConfiguration(String friendlyName, IList`1 errors) +46
Owin.Loader.DefaultLoader.LoadImplementation(String startupName, IList`1 errorDetails) +75
Owin.Loader.DefaultLoader.Load(String startupName, IList`1 errorDetails) +21
Microsoft.Owin.Host.SystemWeb.OwinBuilder.GetAppStartup() +115
Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint() +28
System.Threading.LazyInitializer.EnsureInitializedCore(T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) +115
Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(HttpApplication context) +106
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +534
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +352
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296
What is most irritating about this error is that the Owin-package seems to cause this error. But Owin should not have a reference to Microsoft.SharePoint.Client at all according to the NuGet-documentation.
Or is this whole strack trace misleading and Owin does not have to do anything with this problem?
I encountered the same problem.
For me the problem got solved by removing the .dll that was causing the error from the bin directory. (In my case it was Microsoft.Online.Sharepoint.Tentant.dll)
I encountered the issue as well. It can be circumvented by specifying the startup class in the web.config, so that Owin does not try to search for the correct startup class.
The
appSetting
element overrides theOwinStartup
attribute and naming convention. You can have multiple startup classes (each using anOwinStartup
attribute) and configure which startup class will be loaded in a configuration file using markup similar to the following:<appSettings> <add key="owin:appStartup" value="StartupDemo.ProductionStartup" /> </appSettings>
The following key, which explicitly specifies the startup class and assembly can also be used:
<add key="owin:appStartup" value="StartupDemo.ProductionStartup, StartupDemo" />
Futher details can be found in the documentation.
User contributions licensed under CC BY-SA 3.0