Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Cannot reference Sensor SDK from .NET Class Library #894

Open
dotMorten opened this issue Nov 7, 2019 · 6 comments
Open

Cannot reference Sensor SDK from .NET Class Library #894

dotMorten opened this issue Nov 7, 2019 · 6 comments
Assignees
Labels
Bug Something isn't working CSharp This issue affects only the C# Wrapper Triage Approved The Issue has been approved by an Azure Kinect team member.

Comments

@dotMorten
Copy link

dotMorten commented Nov 7, 2019

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

@dotMorten dotMorten added Bug Something isn't working Triage Needed The Issue still needs to be reviewed by Azure Kinect team members. labels Nov 7, 2019
@dotMorten
Copy link
Author

In addition referencing the project from a .NET Core WPF app, you'll hit a similar issue because it doesn't use the $(Platform) value, but relies on runtime identifiers instead.

@Brent-A
Copy link
Contributor

Brent-A commented Nov 7, 2019

Thanks. We should be publishing a new alpha after we complete #822 and I'll try integrating those suggestions to the NuGet release.

FYI, #822 adds some APIs to expose raw handle access that will make it possible to interop with the body tracking SDK.

@tesych tesych added CSharp This issue affects only the C# Wrapper Triage Approved The Issue has been approved by an Azure Kinect team member. and removed Triage Needed The Issue still needs to be reviewed by Azure Kinect team members. labels Nov 11, 2019
@vpenades
Copy link

Is this still an issue? I thought it would be fixed for 1.4.0...

@qm13 qm13 closed this as completed Jul 11, 2020
@dotMorten
Copy link
Author

@qm13 Was this addressed?

@qm13 qm13 reopened this Jul 13, 2020
@qm13
Copy link
Collaborator

qm13 commented Jul 14, 2020

@dotMorten my bad. I believe this is still an issue.

@tmoody460
Copy link

Any chance there's a workaround for this until this can get fixed?

@qm13 qm13 assigned dasparli and unassigned Brent-A May 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Something isn't working CSharp This issue affects only the C# Wrapper Triage Approved The Issue has been approved by an Azure Kinect team member.
Projects
None yet
Development

No branches or pull requests

7 participants