Je suis en train de concevoir une application à exécuter sur Microsoft HoloLens en utilisant Unity pour l'interaction utilisateur. L'application se connecte à un service Web asmx pour récupérer des données.Unity to Visual Studio: plusieurs assemblages avec une identité équivalente ont été importés
J'ai un programme de test C# pour tester la connexion et la récupération de données à partir du webservice.
je puis suivre ce tutoriel pour générer une dll sur la base wsdl webservice (https://www.youtube.com/watch?v=AifcMzEbKnA)
Si utiliser le script suivant pour générer la dll:
@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
J'ajouté system.Data parce que mon webservice renvoie des données DataSet à partir d'une base de données. J'ai abandonné cette DLL dans le dossier Assets du projet Unity. J'ai également dû supprimer System.Data.dll, System.dll et System.Web.Services.dll dedans (les pris de C: \ Program Files \ Unity Hololens 5.4.0b16-HTP \ Editor \ Data \ Mono \ dossier lib \ mono \ unity)
Lorsque j'utilise l'éditeur Unity, mon application se connecte au service Web et récupère les données sans problème.
étape suivante, je suivais ce tutoriel pour faire une application HoloLens de l'unité (http://hololenshelpwebsite.com/Blog/EntryId/1006/HoloLens-Hello-World)
Bien travailler pour leur propre Bonjour tout le monde, quand j'essayé de construire mon propre projet de l'unité que je reçois l'erreur suivante:
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
J'ajouté un fichier ProjectFileHook.cs sous éditeur avec le contenu suivant:
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();
};
}
}
Mais il semble que cette DOE s rien. Je ne sais pas comment résoudre ce problème en ce moment, et j'ai vraiment besoin d'aide d'experts pour le comprendre.