dotnet 3.1 The located assembly's manifest definition does not match the assembly reference


I have been struggling with this for two days now. I have looked all over the internet and tried many different things, all with no help.

I have a .NET Core 3.1 self contained solution with about 4 projects. I am building the application on my Windows desktop. When I push it to BitBucket, my pipeline runs. It looks like this:


    - step:
          - dotnetcore
          # Restore, Publish and Release the .NET core project
          - dotnet restore
          - dotnet publish ProjectsApi.sln -c Release -r centos.7-x64 -o "deployment" --self-contained
          - deployment/**
    - step:
          - pipe: atlassian/sftp-deploy:0.5.3
              USER: $FTP_USERNAME
              SERVER: $FTP_HOST
              EXTRA_ARGS: $FTP_PORT

The build succeeds and everything is uploaded to my Cent OS 7 server just fine. But when I try to run the application, I get the following:

# ./ProjectApi.Api

Unhandled exception. System.IO.FileLoadException: Could not load file or assembly 'System.ComponentModel, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The located assembly's manifest definition does not match the assembly reference. (0x80131040) File name: 'System.ComponentModel, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

One thing to note is I was using System.ComponentModel at one point. I was using it for data annotations and was getting the same error. I removed them and removed the package just to see if it would fix the issue but it did not. When the package was added, it utilized version 4.3.0. I even tried to install version just to see if that would help and got the same error.

I tried forcing it to recognize the new assembly but that did not work:

    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <assemblyIdentity name="System.ComponentModel" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
            <bindingRedirect oldVersion="" newVersion="4.3.0" />

I tried removing the dll from the deployment folder and replacing it with one I published from my machine and that did not help at all. I am all out of ideas. I can publish the solution and it runs just fine locally. Any thoughts? Thank you.

asked on Stack Overflow Jan 18, 2020 by Jwags

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0