mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 13:00:33 +01:00
Page:
MimeKit and MimeKitLite
Pages
Admin API Reference
Compatibility WireMock.org
Conflict on Microsoft.CodeAnalysis.CSharp
Cors
Could not load file or assembly RestEase
Development Information
Faults
FluentAssertions
Home
KestrelServerOptions
Mapping
MimeKit and MimeKitLite
MyGet preview versions
Pact
Proxying
References
RegexExtended
Request Matcher FormUrlEncodedMatcher
Request Matchers
Request Matching CSharpCode
Request Matching GraphQLMatcher
Request Matching JsonMatcher
Request Matching JsonPartialMatcher
Request Matching JsonPartialWildcardMatcher
Request Matching JsonPathMatcher
Request Matching MimePartMatcher
Request Matching ProtoBuf
Request Matching Tips
Request Matching
Response Templating
Scenarios and States
Settings
Stubbing
Using HTTPS (SSL)
Using WireMock in UnitTests
Using WireMock.Net.Aspire
Using WireMock.Net.Testcontainers
Webhook
What Is WireMock.Net
WireMock as a (Azure) Web App
WireMock as a Windows Service
WireMock as a standalone process
WireMock as dotnet tool
WireMock commandline parameters
WireMock.Org
Xamarin Could not load file or assembly
Clone
6
MimeKit and MimeKitLite
Stef Heyenrath edited this page 2023-09-06 09:01:58 +02:00
Table of Contents
Info
Because WireMock.Net uses MimeKitLite for multipart parsing, this can introduce errors when your project uses 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'
Solution
The only solution for this is to apply the following changes to your project:
<PackageReference Include="MailKit" Version="4.1.0" />
<!-- ⭐ Add an Alias for the MimeKit NuGet -->
<PackageReference Include="MimeKit" Version="4.1.0">
<Aliases>MimeKitAlias</Aliases>
</PackageReference>
<PackageReference Include="WireMock.Net" Version="1.5.35" />
In your C# code change this:
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.
📚 References
Pages
- Home
- What is WireMock.Net
- WireMock.Org
- References
- Settings
- Admin REST API
- Proxying
- Stubbing
- Webhook
- Request Matching
- Response Templating
- Unit Testing
- Using WireMock
- Advanced
- Errors