sshnet / sshnet/SSH.NET

Unable to use DLL in Unity UWP app

Aperta
#411 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
C#
Stelle
4.4k
Fork
993
Merge medio
9g 21h
PR unite (30g)
1

Descrizione

My steps:

Built Renci.SshNet.NET35 and copied the DLL at *\src\Renci.SshNet.NET35\bin\Debug\ into Unity assets

Modified script from here as needed:

 using System.IO;
 using Renci.SshNet;
 using Renci.SshNet.Common;
 using Renci.SshNet.Sftp;
  
 String Host = "ftp.csidata.com";
 int Port = 22;
 String RemoteFileName = "TheDataFile.txt";
 String LocalDestinationFilename = "TheDataFile.txt";
 String Username = "yourusername";
 String Password = "yourpassword";
  void Start(){
 using (var sftp = new SftpClient(Host, Port, Username, Password))
 {
     sftp.Connect();
  
     using (var file = File.OpenWrite(LocalDestinationFilename))
     {
         sftp.DownloadFile(RemoteFileName, file);
     }
  
     sftp.Disconnect();
 }
 }

Build solution aimed at HoloLens/UWP apps:

SDK - Universal 10

Target device - Any device

UWP Build Type - D3D

Changed .dll settings to SDK: Any SDK ; ScriptingBackend: Dot Net ; Don't process: Checked

Unity version: 5.5.1f1

Visual Studio version: 2015 update 3

Debugger tells me:

An exception of type 'System.IO.FileLoadException' occurred in Renci.SshNet.dll but was not handled in user code

Additional information: Could not load file or assembly 'System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I've tried cleaning and rebuilding the solution as well as adding UnityEngine.dll as a reference but with no luck.

Thank you in advance for the help.

Additional info:

I just tried using the DLL from the Renci.SshNet.UAP10 directory and I get the same error.

If I add the lines

 AssemblyName Core = new AssemblyName("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Retargetable=Yes");

 Assembly.Load(Core);

It stops throwing the Exception but I have no way to check if it's connected properly because any other code stops working (like trying to write "Connected." in a UI Unity textbox).

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Riprodurre la build UWP in Unity 5.5.1f1 usando le DLL Renci.SshNet.NET35 e Renci.SshNet.UAP10, iniziando dall’errore segnalato durante il caricamento dell’assembly System.Core. Confrontare le impostazioni delle DLL e i riferimenti agli assembly, quindi verificare che la connessione SftpClient venga eseguita senza FileLoadException e che il successivo codice Unity UI venga eseguito.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
csharp, unity
Ambito
game-dev, operating-systems
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.