.NET core 3.0 and MS Office Interop

I had the same issue. I fixed it by opening the reference properties and setting both “Copy Local” and “Embed Interop Types” to “Yes”.

Update: This actually does the same thing as adding these 2 lines to the COM reference in the .csproj file.

<COMReference Include="Microsoft.Office.Core">
    ...
    <EmbedInteropTypes>True</EmbedInteropTypes>
    <Private>true</Private>
</COMReference>

The “Private” tag isn’t mentioned in the accepted answers, but it prevents a lot of problems.

Leave a Comment