A library I created use a different version of a dependency as my MVC project

0

I have a library I created a few month priors that use a dependency and an MVC project I created right after. Both of them use the "System.Net.Http" dependency. But recently, I download a nugget package, that used a more recent version of that dependency, so it updated it.

Since then I get an error that it cannot find the right dependency. When I look into my "web.config" on the MVC part, it uses the 4.1.1.3 version. But when I start the project and call the library, I get the following error:

System.IO.FileLoadException
  HResult=0x80131040
  Message=Impossible de charger le fichier ou l'assembly 'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' ou une de ses dépendances. La définition trouvée du manifeste de l'assembly ne correspond pas à la référence de l'assembly. (Exception de HRESULT : 0x80131040)
  Source=MusicBrainzServiceAgent
  StackTrace:
  at MusicBrainzServiceAgent.ServiceAgent.DownloadData(String url)
  at MusicBrainzServiceAgent.ServiceAgent.<GetAlbumsByArtistAsync>d__4.MoveNext() in C:\Users\Elgate\source\repos\MusicBrainzServiceAgent\MusicBrainzServiceAgent\ServiceAgent.cs:line 106
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
  at MusicBrainzServiceAgent.ServiceAgent.GetAlbumsByArtist(String artist) in C:\Users\Elgate\source\repos\MusicBrainzServiceAgent\MusicBrainzServiceAgent\ServiceAgent.cs:line 132
  at MusicBrainzSchoolProject.Controllers.CategoriesController.AddAlbums(Int32 id, String artist) in C:\Users\Elgate\source\repos\MusicBrainzSchoolProject\MusicBrainzSchoolProject\Controllers\CategoriesController.cs:line 113
  at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
  at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
  at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
  at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c.<BeginInvokeSynchronousActionMethod>b__9_0(IAsyncResult asyncResult, ActionInvocation innerInvokeState)
  at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult)
  at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
  at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
  at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass11_0.<InvokeActionMethodFilterAsynchronouslyRecursive>b__0()
  at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass11_2.<InvokeActionMethodFilterAsynchronouslyRecursive>b__2()

While I'm at it, here is what's in the web.config for the MVC

<dependentAssembly>
    <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.1.1.3" newVersion="4.1.1.3" />
</dependentAssembly>

Apparently, from what I understand, my library call for the 4.2.0.0 version, while my MVC calls for the 4.1.1.3.

I searched a few link for similar problem, and I tried to clean and rebuild, as well change the version to 4.2.0.0 but then my MVC doesn't start.

c#
.net
asp.net-mvc
dll
dependencies
asked on Stack Overflow Aug 7, 2019 by Elgate • edited Aug 7, 2019 by Elgate

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0