Replies: 5 comments 3 replies
-
The System.Runtime.CompilerServices.Unsafe 6.0.0 nuget package contains an assembly with a different version than 6.0.0 (it's 4.something).
You probably need to add an app.config file that contains the same content as the MimeKit.dll.config file that is bundled with the MimeKit nuget package. |
Beta Was this translation helpful? Give feedback.
-
Many thanks for the quick reply
I’m replacing system.net.mail with MailKit in an existing project.
Target framework 4.7.1
Visual studio 2022 community
My Inno Setup build looks like this…
Source: I:\Documents\Development\PCS\PCS_Emailer\bin\Debug\PCS_Emailer.exe; DestDir: {pf}\PCS_Utility; Flags: ignoreversion
Source: I:\Documents\Development\PCS\PCS_Emailer\bin\Debug\PCS_Emailer.pdb; DestDir: {pf}\PCS_Utility; Flags: ignoreversion
Source: I:\Documents\Development\PCS\PCS_Emailer\bin\Debug\Mailkit.dll; DestDir: {pf}\PCS_Utility; Flags: ignoreversion
Source: I:\Documents\Development\PCS\PCS_Emailer\bin\Debug\Mimekit.dll; DestDir: {pf}\PCS_Utility; Flags: ignoreversion
Source: I:\Documents\Development\PCS\PCS_Emailer\bin\Debug\Mailkit.dll.config; DestDir: {pf}\PCS_Utility; Flags: ignoreversion
Source: I:\Documents\Development\PCS\PCS_Emailer\bin\Debug\Mimekit.dll.config; DestDir: {pf}\PCS_Utility; Flags: ignoreversion
Source: I:\Documents\Development\PCS\PCS_Emailer\bin\Debug\System.Buffers.dll; DestDir: {pf}\PCS_Utility; Flags: ignoreversion
Source: I:\Documents\Development\PCS\PCS_Emailer\bin\Debug\System.Formats.Asn1.dll; DestDir: {pf}\PCS_Utility; Flags: ignoreversion
Source: I:\Documents\Development\PCS\PCS_Emailer\bin\Debug\system.Memory.dll; DestDir: {pf}\PCS_Utility; Flags: ignoreversion
Source: I:\Documents\Development\PCS\PCS_Emailer\bin\Debug\System.Numerics.Vectors.dll; DestDir: {pf}\PCS_Utility; Flags: ignoreversion
Source: I:\Documents\Development\PCS\PCS_Emailer\bin\Debug\System.Runtime.CompilerServices.Unsafe.dll; DestDir: {pf}\PCS_Utility; Flags: ignoreversion
Source: I:\Documents\Development\PCS\PCS_Emailer\bin\Debug\System.Threading.Tasks.Extensions.dll; DestDir: {pf}\PCS_Utility; Flags: ignoreversion
Source: I:\Documents\Development\PCS\PCS_Emailer\bin\Debug\System.ValueTuple.dll; DestDir: {pf}\PCS_Utility; Flags: ignoreversion
From: Jeffrey Stedfast ***@***.***>
Sent: Thursday, 3 October 2024 4:15 PM
To: jstedfast/MailKit ***@***.***>
Cc: ilens ***@***.***>; Author ***@***.***>
Subject: Re: [jstedfast/MailKit] Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1 (Discussion #1822)
The System.Runtime.CompilerServices.Unsafe 6.0.0 nuget package contains an assembly with a different version than 6.0.0 (it's 4.something).
* What target framework are you using?
* What version of Visual Studio are you using?
* Is your build copying over the MimeKit.dll.config and MailKit.dll.config files?
You probably need to add an app.config file that contains the same content as the MimeKit.dll.config file that is bundled with the MimeKit nuget package.
—
Reply to this email directly, view it on GitHub <#1822 (comment)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/AHGWU2F6LDO7E2BT67QICCLZZVNPPAVCNFSM6AAAAABPJ7AWS6VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTAOBTGM2DQMQ> .
You are receiving this because you authored the thread. <https://github.com/notifications/beacon/AHGWU2F4CELXIKVSI4NHAO3ZZVNPPA5CNFSM6AAAAABPJ7AWS6WGG33NNVSW45C7OR4XAZNRIRUXGY3VONZWS33OINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAUVHEU.gif> Message ID: ***@***.*** ***@***.***> >
|
Beta Was this translation helpful? Give feedback.
-
The app config already has that <runtime> code.
From: Jeffrey Stedfast ***@***.***>
Sent: Thursday, 3 October 2024 5:03 PM
To: jstedfast/MailKit ***@***.***>
Cc: ilens ***@***.***>; Author ***@***.***>
Subject: Re: [jstedfast/MailKit] Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1 (Discussion #1822)
Okay, so this is a known issue with .NET Framework. Not sure which version of Visual Studio 2022 you are using (thought the issue had been fixed, but maybe not?).
You need to create an app.config file to solve this issue. See the FAQ for details: https://github.com/jstedfast/MailKit/blob/master/FAQ.md#type-load-exception
—
Reply to this email directly, view it on GitHub <#1822 (reply in thread)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/AHGWU2BWEESJW2BUTMUB7ATZZVTDHAVCNFSM6AAAAABPJ7AWS6VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTAOBTGM4TIOA> .
You are receiving this because you authored the thread. <https://github.com/notifications/beacon/AHGWU2FJE3DAFI2WTCPFGO3ZZVTDHA5CNFSM6AAAAABPJ7AWS6WGG33NNVSW45C7OR4XAZNRIRUXGY3VONZWS33OINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAUVIBY.gif> Message ID: ***@***.*** ***@***.***> >
|
Beta Was this translation helpful? Give feedback.
-
Ah, I’m outside my competence envelope here - where is the app bundle and how can I tell if it’s in it?
(The <runtime> code is in the Mailkit.dll.config as well, and I copied that in my installer)
Is there anywhere I can get System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ?
From: Jeffrey Stedfast ***@***.***>
Sent: Thursday, 3 October 2024 5:19 PM
To: jstedfast/MailKit ***@***.***>
Cc: ilens ***@***.***>; Author ***@***.***>
Subject: Re: [jstedfast/MailKit] Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1 (Discussion #1822)
Is your app.config getting copied into your app bundle?
The app.config file is the only thing you need to solve this issue. If that still doesn't work, then you'll probably need to go and ask the dotnet runtime team for help.
—
Reply to this email directly, view it on GitHub <#1822 (reply in thread)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/AHGWU2HPGFKWJOPFVOP67GDZZVU5RAVCNFSM6AAAAABPJ7AWS6VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTAOBTGQYDONI> .
You are receiving this because you authored the thread. <https://github.com/notifications/beacon/AHGWU2FZQRBGH6EUQLRLVODZZVU5RA5CNFSM6AAAAABPJ7AWS6WGG33NNVSW45C7OR4XAZNRIRUXGY3VONZWS33OINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAUVIJW.gif> Message ID: ***@***.*** ***@***.***> >
|
Beta Was this translation helpful? Give feedback.
-
Thanks for your help – I think I’m going to have to give up. It’s a shame because MailKit looks a really good library
From: Jeffrey Stedfast ***@***.***>
Sent: Thursday, 3 October 2024 5:43 PM
To: jstedfast/MailKit ***@***.***>
Cc: ilens ***@***.***>; Author ***@***.***>
Subject: Re: [jstedfast/MailKit] Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1 (Discussion #1822)
When I say your "app bundle", I'm just asking if the app.config file gets installed by your installer. It didn't look like it to me, that's why I asked.
The nuget versions of System.Runtime.CompilerServices.Unsafe do not match their assembly versions (hence the problem). If you go to https://www.nuget.org/packages/System.Runtime.CompilerServices.Unsafe/6.0.0 - the 6.0.0 nuget package contains the 4.0.4.1 assembly version.
—
Reply to this email directly, view it on GitHub <#1822 (reply in thread)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/AHGWU2HY6LRH3VEZVM2XCPDZZVXZ7AVCNFSM6AAAAABPJ7AWS6VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTAOBTGQZDONI> .
You are receiving this because you authored the thread. <https://github.com/notifications/beacon/AHGWU2GN6THMVLSM5P42S23ZZVXZ7A5CNFSM6AAAAABPJ7AWS6WGG33NNVSW45C7OR4XAZNRIRUXGY3VONZWS33OINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAUVIWG.gif> Message ID: < ***@***.***> ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I have installed 4.8.0 via the NuGet. When I run within the Visual studio environment all works fine
When I make a installer with Inno Setup and include the dlls from the VS version, I get
I notice the version reported in the VS reference is 4.0.40419 : - I have setSpecific Version to False but no luck.
Is the NuGet installer incorrect?
Beta Was this translation helpful? Give feedback.
All reactions