mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-23 00:38:28 +02:00
Updated MimeKit and MimeKitLite (markdown)
@@ -1,5 +1,42 @@
|
|||||||
|
## Info
|
||||||
Because WireMock.Net uses [MimeKitLite](https://www.nuget.org/packages/MimeKitLite) for multipart parsing, this can introduce errors when your project uses [MimeKit](https://www.nuget.org/packages/MimeKit):
|
Because WireMock.Net uses [MimeKitLite](https://www.nuget.org/packages/MimeKitLite) for multipart parsing, this can introduce errors when your project uses [MimeKit](https://www.nuget.org/packages/MimeKit):
|
||||||
|
|
||||||
```
|
## Issue
|
||||||
|
`
|
||||||
error CS0433: The type 'MimeMessage' exists in both 'MimeKit, Version=4.1.0.0, Culture=neutral, PublicKeyToken=bede1c8a46c66814' and 'MimeKitLite, Version=4.1.0.0, Culture=neutral, PublicKeyToken=bede1c8a46c66814'
|
error CS0433: The type 'MimeMessage' exists in both 'MimeKit, Version=4.1.0.0, Culture=neutral, PublicKeyToken=bede1c8a46c66814' and 'MimeKitLite, Version=4.1.0.0, Culture=neutral, PublicKeyToken=bede1c8a46c66814'
|
||||||
```
|
`
|
||||||
|
|
||||||
|
## Solution
|
||||||
|
The only solution for this is to apply the following changes to your project:
|
||||||
|
|
||||||
|
``` xml
|
||||||
|
<PackageReference Include="MailKit" Version="4.1.0" />
|
||||||
|
<PackageReference Include="MimeKit" Version="4.1.0"> ⭐
|
||||||
|
<Aliases>MimeKitAlias</Aliases>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="WireMock.Net" Version="1.5.35" />
|
||||||
|
```
|
||||||
|
|
||||||
|
⭐ add an Alias for the MimeKit NuGet
|
||||||
|
|
||||||
|
In your C# code change this:
|
||||||
|
|
||||||
|
``` csharp
|
||||||
|
extern alias MimeKitAlias; // ⭐ Add this
|
||||||
|
|
||||||
|
namespace MyNamespace
|
||||||
|
{
|
||||||
|
public class MyClass
|
||||||
|
{
|
||||||
|
public void MyMethod()
|
||||||
|
{
|
||||||
|
var mail = new MimeKitAlias::MimeKit.MimeMessage(); // ⭐ Use this
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The code should build now without getting the error.
|
||||||
|
|
||||||
|
:books: References
|
||||||
|
- https://github.com/WireMock-Net/WireMock.Net/issues/990
|
||||||
Reference in New Issue
Block a user