0

Using MailKit in a ASP.Net Web API backend to send out emails from the server. Using MailKit and MimeKit 3.6.0 (latest version).

I can get it working just fine in my dev environment (VS 2019 Pro). However, when I 'publish' the API to a dev server, I get the following message:

Could not load file or assembly 'System.Buffers, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

The references in the app to System.Buffers are to 4.0.3.0, which is what is published to the web server. I can find no reference anywhere to 4.0.2.0. Any ideas where to look next? Is there an explicit reference (possibly) in MailKit or one of its dependencies to a specific version of System.Buffers?

Rob Schripsema
  • 103
  • 1
  • 7
  • https://stackoverflow.com/questions/63019110/could-not-load-file-or-assembly-system-buffers-version-4-0-2-0 – Hans Passant Mar 09 '23 at 23:32
  • Does this answer your question? [The located assembly's manifest definition does not match the assembly reference](https://stackoverflow.com/questions/215026/the-located-assemblys-manifest-definition-does-not-match-the-assembly-reference) – Rob Mar 10 '23 at 00:09
  • I've submitted a bug report to dotnet/sdk here: https://github.com/dotnet/sdk/issues/31147 - it might be helpful to add specifics of your case there. – jstedfast Mar 15 '23 at 13:06

1 Answers1

0

The latest MimeKit 4.x nuget releases include MimeKit.dll.config files that do assembly mapping which seems to resolve this issue.

jstedfast
  • 35,744
  • 5
  • 97
  • 110