Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

Different behavior for packages.config and PackageReference

$
0
0

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:

ILSpy output using packages.config

And here is the output using PackageReference:

enter image description here

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?


Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>