This repository was archived by the owner on Aug 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 631
This repository was archived by the owner on Aug 22, 2024. It is now read-only.
Cannot reference Sensor SDK from .NET Class Library #894
Copy link
Copy link
Open
Labels
BugSomething isn't workingSomething isn't workingCSharpThis issue affects only the C# WrapperThis issue affects only the C# WrapperTriage ApprovedThe Issue has been approved by an Azure Kinect team member.The Issue has been approved by an Azure Kinect team member.
Description
Describe the bug
Create a new .NET Standard Class Library, and you'll be prevented from referencing the SDK due to the class library being AnyCPU.
This limitation should not be put on libraries but only on applications.
To Reproduce
- Create a new .NET Standard Class Library
- Add the Microsoft.Azure.Kinect.Sensor nuget package
- Notice the error in the output window:
1>C:\Users\mn\.nuget\packages\microsoft.azure.kinect.sensor\1.3.0\build\netstandard2.0\Microsoft.Azure.Kinect.Sensor.targets(4,5): error : Azure Kinect only supports the x86/x64 platform ('AnyCPU' not supported)
1>Done building project "Microsoft.Azure.Kinect.BodyTracking.csproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Expected behavior
Check should only be done on applications, not libraries.
Suggested fix
Change the targets file to also check on output type:
<Target Name="EnsureAzureKinectPlatform" BeforeTargets="PrepareForBuild">
<Error Condition="'$(Platform)' != 'x64' AND '$(Platform)' != 'x86' AND '$(OutputType)'!='Library'" Text="Azure Kinect only supports the x86/x64 platform ('$(Platform)' not supported)" />
</Target>Side note
Since such a class library would transitively bring in the kinect sensor package, you should also add the same build files in the nuget package to /buildTransitive/ to ensure the .targets file are run on applications not directly referencing that nuget package.
Desktop (please complete the following information):
- OS with Version: N/A
- SDK Version: 1.3.0
- Firmware version: N/A
Additional context
vpenades
Metadata
Metadata
Assignees
Labels
BugSomething isn't workingSomething isn't workingCSharpThis issue affects only the C# WrapperThis issue affects only the C# WrapperTriage ApprovedThe Issue has been approved by an Azure Kinect team member.The Issue has been approved by an Azure Kinect team member.
