私は、ユーザーの操作のためにUnityを使用してMicrosoft HoloLens上で動作するアプリケーションを設計しています。 アプリケーションはasmx Webサービスに接続してデータを取得します。Visual StudioとのUnity:同等のIDを持つ複数のアセンブリをインポートしました
私は、Webサービスからの接続とデータの取得をテストするためのC#テストプログラムを用意しています。
DLLを生成するには、次のスクリプトを使用する場合、私は、このチュートリアルのWebサービスのWSDLに基づいてDLLを生成する(https://www.youtube.com/watch?v=AifcMzEbKnA)
を追っ:
@echo off
if exist "Service.xml" (
del MyOwnWS.wsdl
echo Rename
rename Service.xml MyOwnWS.wsdl
echo.
)
echo WSDL
call wsdl MyOwnWS.wsdl -o:MyOwnWS.cs
echo.
echo DMCS
call dmcs /target:library MyOwnWS.cs -r:System.Web.Services,System.Data
echo.
echo Done
私は私のWebサービスのでsystem.Dataを追加しましたデータベースからDataSetデータを返します。
私はUnityプロジェクトのAssetsフォルダにそのDLLをドロップしました。 また、System.Data.dll、System.dll、System.Web.Services.dllを削除しなければなりませんでした(C:\ Program Files \ Unity Hololens 5.4.0b16-HTP \ Editor \ Data \ Mono \ lib \ mono \ unityフォルダ)
私はUnityエディタを使用すると、私のアプリケーションはWebサービスに接続し、問題なくデータを取得します。
次のステップ、私はそれは私が、私は次のエラーが表示されUnityから自分のプロジェクトをビルドしようとしたとき、自分自身のHello Worldのために働く一方でユニティ(http://hololenshelpwebsite.com/Blog/EntryId/1006/HoloLens-Hello-World)
からHoloLensアプリケーションを作るために、このチュートリアルに従っ:
error CS1703: Multiple assemblies with equivalent identity have been imported: 'C:\Users\UserA\.nuget\packages\Microsoft.NETCore.Portable.Compatibility\1.0.0\ref\netcore50\System.dll' and 'J:\Work\MyTestUnity\Assets\System.dll'. Remove one of the duplicate references.Copyright (C) Microsoft Corporation. All rights reserved.Microsoft (R) Visual C# Compiler version 1.3.1.60616
は、だから私は、次の内容のエディタの下ProjectFileHook.csファイルを追加しました:
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using UnityEditor;
using SyntaxTree.VisualStudio.Unity.Bridge;
using UnityEngine;
// http://forum.unity3d.com/threads/missing-c-references-to-system-data.11361/
// https://visualstudiogallery.msdn.microsoft.com/8d26236e-4a64-4d64-8486-7df95156aba9
[InitializeOnLoad]
public class ProjectFileHook
{
// necessary for XLinq to save the xml project file in utf8
class Utf8StringWriter : StringWriter
{
public override Encoding Encoding
{
get { return Encoding.UTF8; }
}
}
static void ProcessNodesWithIncludeAttribute(XDocument document, string localName, string includeValue, Action<XElement> action)
{
var nodes = document
.Descendants()
.Where(p => p.Name.LocalName == localName);
foreach (var node in nodes)
{
var xa = node.Attribute("Include");
if (xa != null && !string.IsNullOrEmpty(xa.Value) && string.Equals(xa.Value, includeValue))
{
action(node);
}
}
}
// Remove System.Data from project (not from file system so Unity can compile properly)
static void RemoveFileFromProject(XDocument document, string fileName)
{
ProcessNodesWithIncludeAttribute(document, "None", fileName, element => element.Remove());
}
// Adjust references, by using the default framework assembly instead of local file (remove the HintPath)
static void RemoveHintPathFromReference(XDocument document, string assemblyName)
{
ProcessNodesWithIncludeAttribute(document, "Reference", assemblyName, element => element.Nodes().Remove());
}
static ProjectFileHook()
{
ProjectFilesGenerator.ProjectFileGeneration += (string name, string content) =>
{
var document = XDocument.Parse(content);
RemoveFileFromProject(document, @"Assets\System.Data.dll");
RemoveHintPathFromReference(document, "System.Data");
RemoveFileFromProject(document, @"Assets\System.Web.Services.dll");
RemoveHintPathFromReference(document, "System.Web.Services");
RemoveFileFromProject(document, @"Assets\System.dll");
RemoveHintPathFromReference(document, "System");
var str = new Utf8StringWriter();
document.Save(str);
return str.ToString();
};
}
}
しかし、それは、この雌ジカのようになります。何もない。
私は現時点でどのようにこの問題を解決するかについて迷っています。私は本当に専門家の助けが必要です。