1

I tried to deploy my Asp.net core mvc projekt to our server, but the ISS only logs this error

System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)
File name: 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'

It does work localy, but not on the server.

I found this Could not load file or assembly Microsoft.Extensions.DependencyInjection.Abstractions, Version=1.1.0.0 thread about the problem, but the accepted answer is for the .net Framework, not .net core (and did not work, I did try it) and the later answers are about Azure functions which I dont use.

I use net core 3.1

dturnschek
  • 31
  • 6
  • Download Core on deploy machine(https://dotnet.microsoft.com/download/dotnet/3.1) For a Net application to run on a deploy machine one of two things must happen 1) The version of Net on Build Machine are Deploy Machine has to be the same 2) You publish on build machine which creates a setup.exe fold like commercial software and then run the setup.exe on deploy machine. Net uses windows dlls for many methods and the windows dll have to be same version on build and deploy machines. The setup.exe updates the windows dlls. – jdweng Apr 23 '21 at 09:39
  • The runetime is already installed on the server. The DLL which is named in the error is also depoloyed with the rest of the project. – dturnschek Apr 23 '21 at 10:27
  • Is it same version? – jdweng Apr 23 '21 at 12:09
  • I would've expected it to be, so I never bothered checking (Sorry, its my first time trying to deploy something) The Version on the Sever is 3.something and locally its 5.something. Now the questions is why. I use a DevOps Pipeline / Deplyoment Group. – dturnschek Apr 26 '21 at 05:12

1 Answers1

1

So, this was probably a noob mistake: I use Core 3.1 but NuGet added the references for 5.0

<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="5.0.0.0" />

After downgrading to the 3.1.14 Version, everything

    <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.1.14" />

dturnschek
  • 31
  • 6