Skip to content
This repository was archived by the owner on Aug 22, 2024. It is now read-only.
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

@dotMorten

Description

@dotMorten

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

  1. Create a new .NET Standard Class Library
  2. Add the Microsoft.Azure.Kinect.Sensor nuget package
  3. 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.

Screenshots
image

Desktop (please complete the following information):

  • OS with Version: N/A
  • SDK Version: 1.3.0
  • Firmware version: N/A

Additional context

Metadata

Metadata

Assignees

Labels

BugSomething isn't workingCSharpThis issue affects only the C# WrapperTriage ApprovedThe Issue has been approved by an Azure Kinect team member.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions