1

My mail-provider has made an update, which generated some problems using Dot.Net Mail in an older Windows Form C# solution. I found, that it is recommended to use MailKit/Mimekit instead of Dot.Net mail. So I decided also to upgrade to newer Visual Studio 2019, where I can use NuGet packages.

I installed Visual Studio 2019, installed MailKit using Manage NuGet Packages (Browse, Right Click, Install) and made a simple test-program in C# (Windows Form Solution) where I send an Email with some attachments.

The solution works 100 % - as long as I execute the solution (both debug and Release builds on the PC where the program is build.

When I copy the Release version (exe-file) to a similar PC (Win 10, DotNet 4.8) I get the following error: Could not load File or Assembly 'Mimekit, Version 2.10.0.0, Culture=neutral, PublicKey Token=bede1c8a46c66814' or one of its dependencies. The same happens if I transfer the exe-file to a Win 7 - PC.

I have

  • Checked that both MailKit an MimeKit is listed in the Solutions References
  • Tried to uninstall and reinstall both MailKit and MimeKit (version 2.10.0)
  • Tried to upgrade MimeKit to version 2.10.1

It is my first solution in Visual Studio 2019 - as well as my first use of a NuGet Package. I expected that the built Release Version could be transferred to another PC as a file copy, but something seems to be missing.

I have no clue what to do !?

Abhijit Annaldas
  • 669
  • 4
  • 12
Jada_DK
  • 13
  • 2
  • .net core installs with visual studio 2019, check that you are using .NET framework and not .net core for your mail application – TERMINATOR Dec 27 '20 at 08:33

1 Answers1

1

@Jada_DK, copying executable alone doesn't make the dependencies available on other PC. You'll need to distribute the application through publish wizard or create an installer. Kindly refer the documentation here. Alternatively, if it's a quick sample application you don't intend to distribute, you can copy the entire bin/debug or bin/release folder to another machine and run the application.

Abhijit Annaldas
  • 669
  • 4
  • 12