You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a class library which P/Invokes into a native library. The native library has different names on different platforms, so I'm trying to create a NuGet package with per-runtime identifier targets (one for win and one for unix) and reference assemblies. (*)
My projects include P2P references; the setup is like this:
LibUsbDotNet.LibUsb -> LibUsbDotNet -> LibUsb.Common
LibUsbDotNet.LibUsb is the project which I want to multi-target and for which I want to create the reference libraries.
Unfortunately, it appears that when building, the P2P reference is not resolved and I get lots of compiler errors, like this:
/home/travis/build/LibUsbDotNet/LibUsbDotNet/src/LibUsbDotNet.LibUsb/Descriptors/MonoUsbAltInterfaceDescriptor.cs(25,20): error CS0234: The type or namespace name 'Descriptors' does not exist in the namespace 'LibUsbDotNet' (are you missing an assembly reference?) [/home/travis/build/LibUsbDotNet/LibUsbDotNet/src/refs/LibUsbDotNet.LibUsb.refs.csproj]
LibUsbDotNet.Descriptors is defined in the LibUsbDotNet project, which is referenced using a P2P reference.
Running dotnet build on the .ref.csproj file itself works fine.
Is there anything I can do to get the reference assemblies to compile?
(*) As to "why", the name of the native library is libusb-1.0.dll on Windows, libusb-1.0.so on Linux, etc. I can rename the Windows assembly to usb-1.0.dll but I cannot change the names on Unix. I attempted to do [DllImport("libusb-1.0")] but it appears that CoreCLR will not attempt to suffix the library name if it contains a ., see https://github.com/dotnet/coreclr/blob/master/src/vm/dllimport.cpp#L6213:L6229
The text was updated successfully, but these errors were encountered:
I have a class library which P/Invokes into a native library. The native library has different names on different platforms, so I'm trying to create a NuGet package with per-runtime identifier targets (one for
win
and one forunix
) and reference assemblies. (*)My projects include P2P references; the setup is like this:
LibUsbDotNet.LibUsb -> LibUsbDotNet -> LibUsb.Common
LibUsbDotNet.LibUsb is the project which I want to multi-target and for which I want to create the reference libraries.
Unfortunately, it appears that when building, the P2P reference is not resolved and I get lots of compiler errors, like this:
LibUsbDotNet.Descriptors
is defined in the LibUsbDotNet project, which is referenced using a P2P reference.Running
dotnet build
on the.ref.csproj
file itself works fine.Is there anything I can do to get the reference assemblies to compile?
Useful links:
(*) As to "why", the name of the native library is
libusb-1.0.dll
on Windows,libusb-1.0.so
on Linux, etc. I can rename the Windows assembly tousb-1.0.dll
but I cannot change the names on Unix. I attempted to do[DllImport("libusb-1.0")]
but it appears that CoreCLR will not attempt to suffix the library name if it contains a.
, see https://github.com/dotnet/coreclr/blob/master/src/vm/dllimport.cpp#L6213:L6229The text was updated successfully, but these errors were encountered: