L3tum / HardwareInformation

.NET Standard Cross-Platform Hardware Information Gatherer
MIT License
56 stars 11 forks source link

"Could not load file or assembly Mono.Posix" in .NET 4.8 project #15

Closed steingran closed 4 years ago

steingran commented 4 years ago

Using the nuget (3.0.5) in a .NET Framework 4.8 project yields this error:

Exception: System.IO.FileNotFoundException Message: Could not load file or assembly 'Mono.Posix, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756' or one of its dependencies. The system cannot find the file specified. Source: HardwareInformation TargetSite: Void Open() StackTrace: at void HardwareInformation.Opcode.Open() at MachineInformation HardwareInformation.MachineInformationGatherer.GatherInformation(bool skipClockspeedTest)

L3tum commented 4 years ago

Hi!

Apologies for the incredibly late answer; Github didn't send me any notification.

According to Mono it doesn't currently support .NET 4.8 as seen here. In theory Mono.Posix should be a .NET Standard2.0 package and as such be supported, but a quick test on my part with a new .NET 4.8 project shows that the Mono.Posix.dll is not copied to the output directory.

Since I'm only using it for a "small" part of the library, I'll consider dropping it in the next version and integrating it in another way. I'll need to check a few things before that though.

I currently do not know of a way to quickly resolve this issue aside from changing the framework target. Copying the Mono.Posix libraries in manually seems to cause a PInvoke error. Adding an explicit target framework to the HardwareInformation library for 4.8 immediately ends in error.

I'll keep this issue open for when either Mono supports .NET 4.8 or I'll have implemented an alternative.

Hope I could help

steingran commented 4 years ago

Hello!

Ok, I was not aware that Mono did not support .NET 4.8. Then this issue makes more sense.

Thank you for your reply.

L3tum commented 4 years ago

Hey,

I removed the Mono.Posix dependency in #16 now and it should work as is.

I'll release a new version today or tomorrow for testing.