I develop a C# class library (.NET Framework 4.7.2) that uses the NuGet package Microsoft.Office.Interop.Outlook
. After installing the package with the NuGet Package Manager, the produced assembly has no references to Microsoft.Office.Interop.Outlook
. Instead, the Outlook symbols are copied into my assembly. If I now migrate packages.config
to PackageReference
, the produced assembly references Microsoft.Office.Interop.Outlook
and the Outlook symbols disappear from my assembly.
I confirmed this by looking at the ILSpy output for a small demo project that uses OlAccountType
. Here is the output using packages.config
:
And here is the output using PackageReference
:
Why does the same package behave differently here?
I like the old behavior, because this way, my DLL does not depend on the Outlook DLL. How can I use PackageReference
and still get the old behavior?