简体   繁体   中英

How to install Microsoft.Azure.Devices NuGet package for Unity?

I was working with Unity and Hololens and tried to establish connection to Azure Iot Hub via MQTT protocol. Microsoft provides a tutorial for getting started with Azure IoT Hub in C# , but unfortunately, I encountered a problem with the tutorial:

在此输入图像描述

In the picture above, I have selected Microsoft.Azure.Device NuGet package for installation. I have tried version 1.0.0 and also the latest one available, 1.2.4. The projects were automatically generated by Unity and that is probably the reason, why I do encounter this problem. Which problem? After I try to install the selected NuGet, I encounter the following error:

Could not install package 'Microsoft.Azure.Devices 1.2.4'. You are trying to install this package into a project that targets '.NETFramework,Version=v3.5,Profile=Unity Full v3.5', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

I was like, "Hmm, I must have wrong .NET framework version. I wonder if I can change that..." I tried to go to project properties like this

在此输入图像描述

Microsoft advises changing .NET framework from Properties context menu item: https://technet.microsoft.com/fi-fi/library/bb772098(v=vs.90).aspx (4.24.2017) https://msdn.microsoft.com/en-us/library/bb398202(v=vs.100).aspx (4.24.2017)

However, this feature must be blocked by something, because the view that is supposed to open flashes white and disappears immediately. I suppose Unity doesn't like people tinkering with project properties, but what else can I do? Incompatible .NET framework issue needs to be resolved, so that the NuGet package can be installed, but how do I do that?

In short, how to install Microsoft.Azure.Devices NuGet package for Unity?

Sorry, this isn't possible due Unity's restriction to .net 3.5.

To be exactly, they use a custom version of mono-2.


You could try the new (experimental) .net 4.6 settings in Unity 5.6.

https://forum.unity3d.com/threads/upgraded-mono-net-in-editor-on-5-5-0b4.433541/

在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM