internal static void DeployToDevice(string buildPath, ArrayList referenceList, Engine engine, string transport, bool isDevEnvironment, string assemblyName) { ArrayList peList = GetPeFileList(buildPath, referenceList, isDevEnvironment, assemblyName, engine); // Deploy the pe files to the device. Console.Write("\tDeploying the device test.."); bool isDeployed = engine.Deployment_Execute(peList, false, null); if (string.Equals(transport.ToLower(), "emulator")) { isDeployed = true; } if (isDeployed) { Console.WriteLine(" deployed successfully"); } else { Console.WriteLine(" deployment failure"); throw new ApplicationException("Unable to deploy the test to the device"); } }
protected override void OnRun (DebuggerStartInfo startInfo) { var mfStartInfo = startInfo as MicroFrameworkDebuggerStartInfo; if (mfStartInfo == null)//This should never happen... throw new InvalidOperationException (); var command = mfStartInfo.MFCommand; var portDefinition = ((MicroFrameworkExecutionTarget)command.Target).PortDefinition; using (var deployEngine = new Engine (portDefinition)) { deployEngine.Start (); string newCommand = "/CorDebug_DeployDeviceName:" + portDefinition.PersistName; var listOfAseemblies = new ArrayList (); //TODO: Check if this is robust enough will "be" and "le" really always be in output folder? OutputDirectory = command.OutputDirectory; string dir = command.OutputDirectory; if (deployEngine.IsTargetBigEndian) dir = Path.Combine (dir, "be"); else dir = Path.Combine (dir, "le"); string[] files = Directory.GetFiles (dir, "*.pe"); foreach (var file in files) { newCommand = "/load:" + file + " " + newCommand; using (var fs = new FileStream (file, FileMode.Open)) { byte[] data = new byte[fs.Length]; fs.Read (data, 0, data.Length); listOfAseemblies.Add (data); } } startInfo.Command = newCommand; deployEngine.Deployment_Execute (listOfAseemblies, false, (str) => OnDebuggerOutput (false, "Deploy: " + str + Environment.NewLine)); deployEngine.RebootDevice (Engine.RebootOption.RebootClrWaitForDebugger); } VsPackage.MessageCentre.Session = this; try { CorDebugProcess process = CorDebugProcess.CreateProcess (new DebugPortSupplier ().FindPort ("USB"), startInfo.Command); process.StartDebugging (this, false); // StartDebugging() will either get a connected device into a debuggable state and start the dispatch thread, or throw. } catch (ProcessExitException) { VsPackage.MessageCentre.DeploymentMsg (DiagnosticStrings.InitializeProcessFailedProcessDied); } catch (Exception ex) { VsPackage.MessageCentre.DeploymentMsg (DiagnosticStrings.InitializeProcessFailed); VsPackage.MessageCentre.InternalErrorMsg (false, ex.Message); } }