runtime icon indicating copy to clipboard operation
runtime copied to clipboard

System.Diagnostics.EventLog and System.Management DLLs are not created when publishing a project targeting netstandard and Windows RID

Open hanblee opened this issue 8 years ago • 4 comments

Repro steps:

  1. create a new classlib project: dotnet new classlib
  2. add reference to System.Diagnostics.EventLog and System.Management dotnet add package System.Diagnostics.EventLog dotnet add package System.Management
  3. 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

hanblee avatar Oct 19 '18 16:10 hanblee

@wtgodbe @ericstj can you please help route it?

karelz avatar Oct 19 '18 18:10 karelz

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 avatar Oct 19 '18 19:10 ericstj

@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.

hanblee avatar Oct 19 '18 20:10 hanblee

Opened dotnet/corefx#33150 requesting RID specific implementations for netstandard for these two packages.

hanblee avatar Oct 30 '18 22:10 hanblee