Outlook Interop in .NET Core 3.0?

前端 未结 4 538
小鲜肉
小鲜肉 2021-01-04 11:05

I migrated our project from .NET Framework to .NET Core 3.0 (C#, WPF) and now I can not use Microsoft.Office.Interop.Outlook anymore, because it is not compatib

4条回答
  •  情话喂你
    2021-01-04 11:53

    This worked for me:

    1. Right click Dependencies and click "Add Reference"
    2. Select Microsoft Outlook 16.0 Object Library under the COM tab.
    3. Under Dependencies/COM in your project, select Interop.Microsoft.Office.Interop.Outlook reference, then under "Properties" set "Embed Interop Types" to "Yes"
    4. I also had to uninstall the Microsoft.Office.Interop.Outlook NuGet package because it caused a conflict with the reference in Dependencies/COM.

    Outlook automation is now working fine.

提交回复
热议问题