-
-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
With the MimeKitLite NuGet include I am no longer able to use MailKit library #990
Comments
@sprudel79 In the 1.5.33 version, I included the MimeKitLite as "private". However this had a side effect that the application could not work anymore. So, please check if you use an alias. Else I need to think on a different solution. |
@sprudel79 Would this be an option? |
Thank you very much @StefH for proposing potential solutions. Indeed a docker based approach might help in this case, however it would also add more complexity to my CI/CD process. Right now I have reverted my code to use an older version of WireMock.Net and I don't have any pressure to adjust anything. |
I unlisted that version because it introduced issues for users. |
@sprudel79 |
Hi @StefH, I am on vacation right now and will be back on that project beginning of September...I'll let you know, thanks. |
Hi @StefH , In the csproj file I have these references: <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" /> I had to add a reference to MimeKit directly since I was not able to get things working with an alias for MailKit directly. Next in my C# code I have these lines: extern alias MimeKitAlias;
namespace MyNamespace
{
public class MyClass
{
public void MyMethod()
{
var mail = new MimeKitAlias::MimeKit.MimeMessage();
}
}
} At least I am able to build my code now without getting the error I had mentioned on top. with the error: |
@sprudel79 I was wondering, will this fix also work the other way around, so if I define that Alias in the code from WireMock? |
Thanks to you for taking this up. |
No, as far as I can see, I don't expose MimeKit in an api. |
@sprudel79 https://github.com/WireMock-Net/WireMock.Net/wiki/MyGet-preview-versions |
Thank you very much @StefH, I have updated my environment to use the preview version of WireMock.Net. Furthermore I have removed my local alias handling. |
@sprudel79 |
Describe the bug
I have just updated to latest WireMock.Net version 1.5.34 and my local project returned build errors in one of my classes where I have used MailKit (version 4.1.0) library that in itself contains "MimeKit" library.
Since WireMock.Net references "MimeKitLite" now, I got e.g. the following error:
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'
Test to reproduce
Create a sample project and add a reference
and
Now in a class try to use e.g.
var mimeMessage = new MimeMessage();
Other related info
I am using .NET 6.0.20
I could perhaps work with an alias to reference MimeKit assembly directly in my code but I would like to ask for any feedback if this is now the expected behavior or not, thank you.
The text was updated successfully, but these errors were encountered: