2016-09-16 8 views
0

私は、正常にコンパイルして.dllファイルを生成するソースコードを持つカスタムライブラリを持っています。HoloLensプロジェクトへのカスタムDLLの統合

質問:次のエラーを考慮して、このDLLをHoloLensプロジェクトに含める最良の方法は何ですか?

私のアプローチ

スタンドアロンライブラリのproject.jsonファイルは以下の通りです:

{ 
    "dependencies": { 
    "Microsoft.NETCore.UniversalWindowsPlatform": "5.1.0", 
    "Newtonsoft.Json": "9.0.1" 
    }, 
    "frameworks": { 
    "uap10.0": {} 
    }, 
    "runtimes": { 
    "win10-arm": {}, 
    "win10-arm-aot": {}, 
    "win10-x86": {}, 
    "win10-x86-aot": {}, 
    "win10-x64": {}, 
    "win10-x64-aot": {} 
    } 
} 

または私はまたに応じて、NuGetパッケージとして追加する機会を持っている:
- Microsoft.NETCore .UniversalWindowsPlatform(> = 5.2.2)
- Newtonsoft.Json(> = 9.0.1)
- Microsoft.EntityFrameworkCore.Tools(> = 1.0.0-preview2-final)
このライブラリをUnity for Hololensによって作成された別のVS2015ソリューションに含める必要があります。自動的にUnityが構築されたソリューションは、3つのプロジェクトで構成されていますHoloToolkitフォルダを含む1)Assembly-CSharp、2)Assembly-CSharp firstpass及び3)Origami

screenshot

私はHoloToolkit for Unityフォルダからスクリプトを取って、私はGameObjectでそれを適用します。イベントがトリガされ、正常に実行されたら、このカスタムライブラリによって提供されるいくつかの関数を呼び出して、同じスクリプト(例:GazeManager.cs)から処理する必要があります。 Iコードでusing MyLibraryを添加GazeManager.cs

  • とReferenceManagerに参照として追加:プロジェクト1のproject.json)は以下

    { 
        "dependencies": { 
        "Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0" 
        }, 
        "frameworks": { 
        "uap10.0": {} 
        }, 
        "runtimes": { 
        "win10-arm": {}, 
        "win10-arm-aot": {}, 
        "win10-x86": {}, 
        "win10-x86-aot": {}, 
        "win10-x64": {}, 
        "win10-x64-aot": {} 
        } 
    } 
    

    ある私は2つの方法で試みました。ライブラリが正しく認識されますが、その後、単に宣言public MyLibrary objectInMyLibraryのような変数が正しく次のエラーでプログラムをコンパイルするプログラムからスイッチを作る:

The command ""C:\Users\Antonino\Documents\UnityToVS2015Projects\HoloAcademy101 - Origami\Origami\App\Unity\Tools\AssemblyConverter.exe" -platform=uap -lock="C:\Users\lakeb\Documents\UnityToVS2015Projects\HoloAcademy101 - Origami\Origami\App\Origami\project.lock.json" -bits=32 -configuration=Debug -removeDebuggableAttribute=False -path="." -path="..\Players\UAP\x86\Debug" "C:\Users\lakeb\Documents\UnityToVS2015Projects\HoloAcademy101 - Origami\Origami\App\Origami\Assembly-CSharp.dll" "C:\Users\lakeb\Documents\UnityToVS2015Projects\HoloAcademy101 - Origami\Origami\App\Origami\Assembly-CSharp-firstpass.dll" "C:\Users\lakeb\Documents\UnityToVS2015Projects\HoloAcademy101 - Origami\Origami\App\Origami\UnityEngine.dll" "C:\Users\lakeb\Documents\UnityToVS2015Projects\HoloAcademy101 - Origami\Origami\App\Origami\UnityEngine.UI.dll" "C:\Users\lakeb\Documents\UnityToVS2015Projects\HoloAcademy101 - Origami\Origami\App\Origami\UnityEngine.HoloLens.dll" "C:\Users\lakeb\Documents\UnityToVS2015Projects\HoloAcademy101 - Origami\Origami\App\Origami\UnityEngine.Networking.dll" "C:\Users\lakeb\Documents\UnityToVS2015Projects\HoloAcademy101 - Origami\Origami\App\Origami\UnityEngine.VR.dll"" exited with code 1.

  • [前の手順をキャンセルすると、コンパイルを持っています折り紙再び]私は思っ第二の方法はproject.jsonファイル

    の行を挿入することによって、それを追加して「my.hololens.library」:「バージョン」

この場合、私は、次のエラー

Payload contains two or more files with the same destination path 'System.Net.Sockets.dll'. Source files: C:\Users\Antonino.nuget\packages\runtime.win.System.Net.Sockets\4.1.0\runtimes\win\lib\netcore50\System.Net.Sockets.dllC:\Users\Antonino.nuget\packages\System.Net.Sockets\4.0.0\lib\netcore50\System.Net.Sockets.dll Payload contains two or more files with the same destination path 'System.Diagnostics.Tools.dll'. Source files: C:\Users\Antonino.nuget\packages\runtime.any.System.Diagnostics.Tools\4.0.1\lib\netcore50\System.Diagnostics.Tools.dllC:\Users\Antonino.nuget\packages\System.Diagnostics.Tools\4.0.0\lib\netcore50\System.Diagnostics.Tools.dll Payload contains two or more files with the same destination path 'System.Threading.Timer.dll'. Source files: C:\Users\Antonino.nuget\packages\runtime.any.System.Threading.Timer\4.0.1\lib\netcore50\System.Threading.Timer.dllC:\Users\Antonino.nuget\packages\System.Threading.Timer\4.0.0\lib\netcore50\System.Threading.Timer.dll Version conflict detected for System.Collections. Origami (>= 1.0.0) -> Assembly-CSharp (>= 1.0.0) -> my.hololens.library (>= version) -> Microsoft.EntityFrameworkCore.Tools (>= 1.0.0-preview2-final) -> Microsoft.EntityFrameworkCore.Design (>= 1.0.0-preview2-final) -> Microsoft.EntityFrameworkCore.Design.Core (>= 1.0.0-preview2-final) -> Microsoft.AspNetCore.Hosting.Abstractions (>= 1.0.0) -> Microsoft.AspNetCore.Http.Abstractions (>= 1.0.0) -> System.Reflection.TypeExtensions (>= 4.1.0) -> System.Linq (>= 4.1.0) -> System.Collections (>= 4.0.11) Origami (>= 1.0.0) -> Microsoft.NETCore.UniversalWindowsPlatform (>= 5.0.0) -> Microsoft.NETCore.Runtime (>= 1.0.0) -> Microsoft.NETCore.Runtime.CoreCLR-arm (>= 1.0.0) -> System.Collections (= 4.0.10). One or more packages are incompatible with UAP,Version=v10.0 (win10-x86-aot). One or more packages are incompatible with UAP,Version=v10.0 (win10-arm-aot). System.Reflection.Emit.ILGeneration 4.0.1 provides a compile-time reference assembly for System.Reflection.Emit.ILGeneration on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-x86-aot. System.Reflection.Emit.ILGeneration 4.0.1 provides a compile-time reference assembly for System.Reflection.Emit.ILGeneration on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-x64-aot. System.Reflection.Emit.ILGeneration 4.0.1 provides a compile-time reference assembly for System.Reflection.Emit.ILGeneration on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-x86-aot. System.Reflection.Emit.ILGeneration 4.0.1 provides a compile-time reference assembly for System.Reflection.Emit.ILGeneration on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-x64-aot. One or more packages are incompatible with UAP,Version=v10.0 (win10-x64-aot). Version conflict detected for System.Collections. Assembly-CSharp (>= 1.0.0) -> my.hololens.library (>= version) -> Microsoft.EntityFrameworkCore.Tools (>= 1.0.0-preview2-final) -> Microsoft.EntityFrameworkCore.Design (>= 1.0.0-preview2-final) -> Microsoft.EntityFrameworkCore.Design.Core (>= 1.0.0-preview2-final) -> Microsoft.AspNetCore.Hosting.Abstractions (>= 1.0.0) -> Microsoft.AspNetCore.Http.Abstractions (>= 1.0.0) -> System.Reflection.TypeExtensions (>= 4.1.0) -> System.Linq (>= 4.1.0) -> System.Collections (>= 4.0.11) Assembly-CSharp (>= 1.0.0) -> Microsoft.NETCore.UniversalWindowsPlatform (>= 5.0.0) -> Microsoft.NETCore.Runtime (>= 1.0.0) -> Microsoft.NETCore.Runtime.CoreCLR-arm (>= 1.0.0) -> System.Collections (= 4.0.10). One or more packages are incompatible with UAP,Version=v10.0 (win10-x64-aot). One or more packages are incompatible with UAP,Version=v10.0 (win10-x86-aot). System.Reflection.Emit.ILGeneration 4.0.1 provides a compile-time reference assembly for System.Reflection.Emit.ILGeneration on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-arm-aot. One or more packages are incompatible with UAP,Version=v10.0 (win10-arm-aot). System.Reflection.Emit.ILGeneration 4.0.1 provides a compile-time reference assembly for System.Reflection.Emit.ILGeneration on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-arm-aot.

私は行くものに困惑していましたが。誰かが移植可能なライブラリを作ると言っていましたが、NETFrameworkとNETCoreとNETStandardの間の関係を調べようとしましたが、予想よりも複雑に思えます。

答えて

2

Unity 3dは、.Net Coreフレームワークを使用するライブラリの統合をサポートしていません。ライブラリを.Net Framework 3.5ライブラリとして作成し、UnityプロジェクトのAssets/Pluginsフォルダにドロップしてみてください。資産フォルダ 更新インスペクタのプロパティで

+0

@Cameronに感謝します。私は.NET Framework 3.5で翻訳を完了しました...受け入れられました。良い一日を! – Antonino

2

あなたがこのプロジェクトにコードUWPライブラリプロジェクトとポートを作成し、コンパイルし、エラーを削除する必要が 置きコンパイルのdllあなたは今

in this image

下回ることができます示すように、 #if !UNITY_EDITORブロック

+0

あなたのソリューションにも感謝します。 Cameron [とあなたも]が言ったようにコードを移植すること、つまりdllを.Net Framework 3.5ライブラリとして考えることは、このトリックを作りました。良い一日を過ごしてください! – Antonino

関連する問題