sharpbrick / powered-up

.NET implementation of the LEGO PoweredUp Protocol
MIT License
94 stars 19 forks source link

Internalize WinRT dependency & re-release CLI as a net6.0 only #180

Open tthiery opened 2 years ago

tthiery commented 2 years ago

The packaging issue of the CsWinRT project seem to be resolved with the .NET 6 release wave. There is a diff showing the expected behavior.

tthiery commented 6 months ago

When using the CsWinRTEmbedded option I need to specify the types used (directly and indirectly). Unfortunately, this does not end well dependency-wise.

  <PropertyGroup>
    <CsWinRTIncludes>
      Windows.Foundation;
      Windows.Devices.Bluetooth.Advertisement.BluetoothLEAdvertisement
      Windows.Devices.Bluetooth.Advertisement.BluetoothLEAdvertisementWatcher;
      Windows.Devices.Bluetooth.Advertisement.BluetoothLEScanningMode;
      Windows.Devices.Bluetooth.Advertisement.BluetoothLEAdvertisementReceivedEventArgs;
      Windows.Devices.Bluetooth.Advertisement.IBluetoothLEAdvertisement
      Windows.Devices.Bluetooth.Advertisement.IBluetoothLEAdvertisementBytePattern;
      Windows.Devices.Bluetooth.Advertisement.IBluetoothLEAdvertisementReceivedEventArgs;
      Windows.Devices.Bluetooth.Advertisement.IBluetoothLEAdvertisementPublisher;
      Windows.Devices.Bluetooth.Advertisement.IBluetoothLEAdvertisementWatcher;
      Windows.Devices.Bluetooth.Advertisement.BluetoothLEManufacturerData;
      Windows.Devices.Bluetooth.Advertisement.IBluetoothLEManufacturerData;
      Windows.Devices.Bluetooth.BluetoothLEAppearance;
      Windows.Devices.Bluetooth.BluetoothSignalStrengthFilter;
      Windows.Devices.Bluetooth.BluetoothDeviceId;
      Windows.Devices.Bluetooth.BluetoothLEDevice;
      Windows.Devices.Bluetooth.GenericAttributeProfile;
      Windows.Devices.Bluetooth.BluetoothAddressType;
      Windows.Devices.Bluetooth.BluetoothCacheMode;
      Windows.Devices.Bluetooth.BluetoothConnectionStatus;
      Windows.Devices.Bluetooth.BluetoothError;
      Windows.Devices.Bluetooth.IBluetoothDeviceId;
      Windows.Devices.Bluetooth.IBluetoothLEAppearance;
      Windows.Devices.Bluetooth.IBluetoothSignalStrengthFilter;
      Windows.Devices.Bluetooth.IBluetoothLEDevice;
      Windows.Storage.Streams.IBuffer;
      Windows.Storage.Streams.Buffer;
      Windows.Storage.Streams.IInputStream;
      Windows.Storage.Streams.IOutputStream;
      Windows.Storage.Streams.InputStreamOptions;
      Windows.Storage.Streams.IRandomAccessStream;

      Windows.Storage.Streams.IContentTypeProvider;
      Windows.Devices.Enumeration.IDeviceAccessInformation;
      Windows.Devices.Enumeration.DeviceAccessChangedEventArgs;
      Windows.Devices.Enumeration.IDeviceAccessChangedEventArgs;
      Windows.Devices.Enumeration.DeviceAccessStatus;
      Windows.Devices.Enumeration.DeviceAccessInformation;
      Windows.Devices.Enumeration.DeviceClass;
    </CsWinRTIncludes>
    <CsWinRTExcludes>
      Windows.Foundation.Diagnostic;
      Windows.Devices.Bluetooth.IBluetoothLEDevice2;
      Windows.Devices.Bluetooth.IBluetoothLEDevice3;
      Windows.Devices.Bluetooth.IBluetoothLEDevice4;
      Windows.Storage.Streams.IRandomAccessStreamReferenceStatics;
      Windows.Storage.Streams.RandomAccessStreamReference;
      Windows.Foundation.PropertyType;
    </CsWinRTExcludes>
  </PropertyGroup>

With 1 remaining issue which can not be resolved without including the whole rest of WinRT.

CsWinRT\Windows.Devices.Bluetooth.cs(593,52): error CS0234: [..] "DeviceInformation" [..]  "Windows.Devices.Enumeration" [..]

There is a request to exclude members not needed from the projection in this issue in the CsWinRT repo. We may need to wait till this is implemented or another way shows up.