How are references to .net standard/.net "full" assemblies resolved?

时间:2017-10-12 09:39:32

标签: .net .net-standard

I'd like to understand how .net standard and .net full can coexist in a single solution, and would there be some problems in this side-by-side development.

So here's a (not-so-imaginary) setup:

  • Serilog, shipped as nuget package containing both .net Standard 1.0 and .net 4.5 assemblies
  • project LibStd targeting .net Standard 1.0
    • references Serilog (.net Standard 1.0 assembly)
  • project LibFull targeting .net 4.5.2
    • references Serilog (.net 4.5 assembly)
  • project Startup targeting .net 4.5.2
    • references LibStd and LibFull

When I build this solution, target bin may contain either Standard or 4.5 Serilog's assembly (depending on the build order). Either way, everything seems to work (the code produces intended results, logging works, so far so good). If I try dumping the referenced types (Serilog's ILogger, for example), I see that they come from whichever assembly lies in bin (i.e., LibStd may call upon type from Serilog 4.5 w/o any issue). So far, so good.

My question is: is this supposed to work this way? Can I rely on this working in future? Or should I be on lookout for some unexpected behavior and avoid mixing Standard and Full versions of the same dependency in one application?

0 个答案:

没有答案
相关问题