System.Diagnostics.EventLog and System.Management DLLs are not created when publishing a project targeting netstandard and Windows RID
Repro steps:
- create a new classlib project:
dotnet new classlib - add reference to System.Diagnostics.EventLog and System.Management
dotnet add package System.Diagnostics.EventLogdotnet add package System.Management - publish the project
dotnet publish
Expected behavior:
RID specific publish output to contain System.Diagnostics.EventLog.dll and System.Management.dll
e.g., netstandard2.0/publish/runtimes/win/lib/netstandard2.0/System.Diagnostics.EventLog.dll
Actual behavior:
publish output only contains stub DLLs under netstandard2.0/ which throw PNSE
Note
This behavior is different from other packages in the Windows Compatibility Pack. For example, when one publishes a classlib project with a reference to Microsoft.Win32.Registry, in addition to the stub DLL (netstandard2.0/publish/Microsoft.Win32.Registry.dll), win-RID specific DLL is created (netstandard2.0/publish/runtimes/win/lib/netstandard2.0/Microsoft.Win32.Registry.dll).
/cc @weshaggard
@wtgodbe @ericstj can you please help route it?
The premise of this is broken: publishing for netstandard doesn't provide any guarantees of producing a runnable layout. I've mentioned this before here and here, and probably a dozen other places. @terrajobst can you add this to the FAQ or share a doc?
That said if your goal is instead to share the RID specific implementations of these assemblies with more frameworks than just NETCoreApp, then the owners of those libraries would need to change their projects from cross-compiling for NETCoreApp-RID to netstandard-RID, here and here. Of course that would only work if they API they need to implement these is actually supported there.
@ericstj The use case for this is for a plugin framework (the plugin host could be .NET Core or .NET Framework app) where the plugin dependencies are not known statically, but based on your description, targeting netstandard2.0 and relying on the output of dotnet publish for the plugin is NOT the right approach. Do you have any suggestion?
On the discrepancy between Microsoft.Win32.Registry and Systems.Diagnostics.EventLog as described in the Note section above, is it fair to say that the difference is due to how the library owners wrote their projects? The inconsistency among them is adding to the confusion.
Opened dotnet/corefx#33150 requesting RID specific implementations for netstandard for these two packages.