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:
image: mcr.microsoft.com/dotnet/core/sdk
pipelines:
default:
- step:
caches:
- dotnetcore
script:
# Restore, Publish and Release the .NET core project
- dotnet restore
- dotnet publish ProjectsApi.sln -c Release -r centos.7-x64 -o "deployment" --self-contained
artifacts:
- deployment/**
- step:
script:
- pipe: atlassian/sftp-deploy:0.5.3
variables:
REMOTE_PATH: $FTP_REMOTE_PATH
USER: $FTP_USERNAME
SERVER: $FTP_HOST
LOCAL_PATH: $FTP_LOCAL_PATH
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=4.0.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The located assembly's manifest definition does not match the assembly reference. (0x80131040) File name: 'System.ComponentModel, Version=4.0.4.0, 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 4.0.4.0 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:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.ComponentModel" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
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.
User contributions licensed under CC BY-SA 3.0