Search code examples
packageowin.net-assembly

The located assembly's manifest definition does not match the assembly reference : Exception from HRESULT: 0x80131040


In my project microsoft.owin has version 3.1.0.0 but it asks for older version 2.1.0.0 . I tried to install microsoft.owin but haven't succeeded . My project framework is 4.5.2 . I tried to install nuget package of this assembly but it's not installed . Can anyone tell me how to solve this error . How can install package 2.1.0.0 version . I tried to redirect it but same error .

   ERROR

   Could not load file or assembly 'Microsoft.Owin, Version=2.1.0.0,       Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.       The located assembly's manifest definition does not match the assembly  reference. (Exception from HRESULT: 0x80131040)

Source Error:

        Line 65:             //    ClientSecret = ""
        Line 66:             //});
        Line 67:         }
        Line 68:     }
        Line 69: }
        === Pre-bind state information ===
        LOG: DisplayName = Microsoft.Owin, Version=2.1.0.0, Culture=neutral,  PublicKeyToken=31bf3856ad364e35
        (Fully-specified)
        LOG: Appbase = file:///C:/xxxx/yyyy/uuuu/ldap/
        LOG: Initial PrivatePath = C:\xxxx\yyyy\uuuu\ldap\bin
        Calling assembly : Microsoft.AspNet.Identity.Owin, Version=2.0.0.0,      Culture=neutral, PublicKeyToken=31bf3856ad364e35.
===
        LOG: This bind starts in default load context.
        LOG: Using application configuration file: C:\xxxx\yyyy\uuuu\ldap\web.config
        LOG: Using host configuration file: \\xyz.df.xcxc.com\sdsds\yuyuy\****\My Documents\IISExpress\config\aspnet.config
        LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
        LOG: Post-policy reference: Microsoft.Owin, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
        LOG: Attempting download of new URL file:///C:/Users/****/AppData/Local/Temp/Temporary ASP.NET Files/root/b0f32b6a/7c9b41cc/Microsoft.Owin.DLL.
        LOG: Attempting download of new URL file:///C:/Users/****/AppData/Local/Temp/Temporary ASP.NET Files/root/b0f32b6a/7c9b41cc/Microsoft.Owin/Microsoft.Owin.DLL.
        LOG: Attempting download of new URL file:///C:/xxxx/yyyy/uuuu/ldap/bin/Microsoft.Owin.DLL.
        WRN: Comparing the assembly name resulted in the mismatch: Major Version
        ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated. 

Stack Trace:

          [FileLoadException: Could not load file or assembly 'Microsoft.Owin, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
   ldap.Startup.ConfigureAuth(IAppBuilder app) in C:\xxxx\yyyy\uuuu\ldap\App_Start\Startup.Auth.cs:67
   ldap.Startup.Configuration(IAppBuilder app) in C:\xxxx\yyyy\uuuu\ldap\Startup.cs:9

         [TargetInvocationException: Exception has been thrown by the target of an invocation.]
         System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
         System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +128
         System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +142
   Owin.Loader.<>c__DisplayClass12.<MakeDelegate>b__b(IAppBuilder builder) +93
         Owin.Loader.<>c__DisplayClass1.<LoadImplementation>b__0(IAppBuilder builder) +212
         Microsoft.Owin.Host.SystemWeb.OwinAppContext.Initialize(Action`1 startup) +873
         Microsoft.Owin.Host.SystemWeb.OwinBuilder.Build(Action`1 startup) +51
         Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint() +101
         System.Threading.LazyInitializer.EnsureInitializedCore(T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) +135
         Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(HttpApplication context) +160
         System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +580
         System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +165
              System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +267
          System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +341

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

please help to solve this issue . how to install the older version of microsoft.owin .


Solution

  • One solution is to downgrade your version of Microsoft.Owin.

    1. Right-click your project in Visual Studio.
    2. Choose "Manage Nuget Packages...".
    3. Under Installed, choose "Microsoft.Owin".
    4. In the "Version" dropdown, choose 2.1.0
    5. Click "Update".

    enter image description here