Skip to content

Commit 1406948

Browse files
committed
Added screen shots and remote connectivity cleanup
1 parent 2027a34 commit 1406948

8 files changed

Lines changed: 63 additions & 35 deletions

File tree

docs/ScreenShot-MenuItems.png

9.45 KB
Loading

docs/ScreenShot-ToolsOptions.png

31.3 KB
Loading

readme.md

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,38 @@
11
# [VS .NET SSH Debugger](https://github.com/SuessLabs/RemoteDebug.git)
22

3-
Remotely deploy and debug your .NET C# apps via SSH to Linux using Visual Studio.
3+
Remotely deploy and debug your .NET C# apps via SSH to Linux using Visual Studio 2022.
44

55
> WARNING: This is a work in progress!
66
77
Visual Studio's "attach to process via SSH" is cute, but it lacks deployment and automatic attaching. This project aims to allow you to do just that when programming for your Linux VM or Raspberry Pi over the network.
88

9-
This project was inspired by [VS Mono Debugger](https://github.com/GordianDotNet/VSMonoDebugger).
9+
This project was inspired by [VS Mono Debugger](https://github.com/GordianDotNet/VSMonoDebugger) and their amazing efforts for cross-platform development.
1010

11-
## To Do
11+
## Overview
12+
13+
Allow developers to build, deploy and debug projects on their remote Linux (Ubuntu, Raspberry PI, etc) devices! Users can choose to use SSH with either a _private key_ or _password_.
14+
15+
### Usage
16+
17+
![VS Menu](docs/ScreenShot-MenuItems.png)
18+
19+
* Build and upload to remote devices (_yes, this is a real pain_)
20+
* Remote debugging (_Work-in-Progress_)
21+
22+
### Customize your connections
23+
24+
![Tools Options](docs/ScreenShot-ToolsOptions.png)
25+
26+
## Action Items
1227

1328
In order to get this project moving, the following must be done.
1429

15-
* [X] Create extension project for VS2022 (_VS2019 coming soon_).
16-
* [X] SSH library
17-
* [X] SFTP library
18-
* [ ] Store settings (globally; per-project)
19-
* IP, User, Pass, default-folder `"~\.XRemoteDbg\(proj-name)"`
20-
* [ ] TEST: Perform upload to remote machine
21-
* [ ] TEST: Attach to process
22-
* [ ] Figure out how to, OnRun: upload, attach, remote-debug
30+
* [X] Create extension project for VS2022
31+
* [X] SSH, SFTP, and SCP communication
32+
* [X] Store settings (globally; per-project)
33+
* [X] IP, User, Pass, default-folder `"~/VsLinuxDbg/(proj-name)"`
34+
* [X] Perform upload to remote machine
35+
* [ ] Attach to process
2336

2437
## References
2538

src/VsLinuxDebugger/Commands.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ private void MessageBox(string message, string title = "Error") => VsShellUtilit
7878
/// <summary>VS Menu Command IDs. This must be insync with .vsct values.</summary>
7979
private sealed class CommandIds
8080
{
81-
public const int CmdBuildDeployDebug = 0x1002;
8281
public const int CmdBuildDeployOnly = 0x1001;
82+
public const int CmdBuildDeployDebug = 0x1002;
8383
public const int CmdDebugOnly = 0x1003;
8484
////public const int CmdPublishOnly = 0x1006;
8585
////public const int CmdPublishDebug= 0x1007;

src/VsLinuxDebugger/Core/RemoteDebugger.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ private void BuildBegin()
158158

159159
private void BuildCleanup()
160160
{
161-
// TODO: The file should be located in the project's output
162-
File.Delete(_launchJsonPath);
161+
if (File.Exists(_launchJsonPath))
162+
File.Delete(_launchJsonPath);
163163

164164
//// BuildEvents.OnBuildDone -= BuildEvents_OnBuildDoneAsync;
165165
//// BuildEvents.OnBuildProjConfigDone -= BuildEvents_OnBuildProjConfigDone;

src/VsLinuxDebugger/Core/SshTool.cs

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public string Bash(string command)
3737
return "Cannot connect to remote host to execute Bash command.";
3838
}
3939

40+
LogOutput($"BASH> {command}");
4041
var cmd = _ssh.RunCommand(command);
4142

4243
return cmd.Result;
@@ -48,18 +49,26 @@ public string Bash(string command)
4849
}
4950

5051
/// <summary>Cleans the contents of the deployment path.</summary>
51-
public void CleanDeploymentFolder() => Bash($"sudo rm -rf {_opts.RemoteDeployBasePath}/*");
52+
public void CleanDeploymentFolder()
53+
{
54+
//// Bash($"sudo rm -rf {_opts.RemoteDeployBasePath}/*");
55+
Bash($"rm -rf {_opts.RemoteDeployBasePath}/*");
56+
}
5257

5358
public bool Connect()
5459
{
5560
PrivateKeyFile keyFile = null;
5661
try
5762
{
58-
keyFile = new PrivateKeyFile(_opts.UserPrivateKeyPath);
63+
if (_opts.UserPrivateKeyEnabled)
64+
keyFile = new PrivateKeyFile(_opts.UserPrivateKeyPath);
5965
//// keyFile = new PrivateKeyFile(_opts.UserKeyFilePath, password);
6066
}
61-
catch (Exception)
67+
catch (Exception ex)
6268
{
69+
LogOutput($"Private key error - {ex.Message}");
70+
LogOutput("Issue obtaining private key. Please check your settings to ensure a valid file exists (Tools > Options).");
71+
return false;
6372
}
6473

6574
try
@@ -114,9 +123,10 @@ public void Dispose()
114123

115124
public void MakeDeploymentFolder()
116125
{
117-
Bash($"sudo mkdir -p {_opts.RemoteDeployBasePath}");
118-
Bash($"sudo mkdir -p {_opts.RemoteDeployDebugPath}");
119-
Bash($"sudo mkdir -p {_opts.RemoteDeployReleasePath}");
126+
// do we need SUDO?
127+
Bash($"mkdir -p {_opts.RemoteDeployBasePath}");
128+
Bash($"mkdir -p {_opts.RemoteDeployDebugPath}");
129+
Bash($"mkdir -p {_opts.RemoteDeployReleasePath}");
120130

121131
var group = string.IsNullOrEmpty(_opts.UserGroupName)
122132
? string.Empty
@@ -363,8 +373,10 @@ private bool PayloadDecompress(string pathBuildTarGz, bool removeTarGz = true)
363373
{
364374
try
365375
{
366-
var cmd = $"set -e;cd \"{_opts.RemoteDeployDebugPath}\"";
367-
cmd += $";tar -zxf \"{pathBuildTarGz}\"";
376+
var cmd = "set -e";
377+
cmd += $";cd \"{_opts.RemoteDeployDebugPath}\"";
378+
cmd += $";tar -zxf \"{_tarGzFileName}\"";
379+
////cmd += $";tar -zxf \"{pathBuildTarGz}\"";
368380

369381
if (removeTarGz)
370382
cmd += $";rm \"{pathBuildTarGz}\"";

src/VsLinuxDebugger/DebuggerPackage.vsct

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
</Strings>
4444
</Menu>
4545
</Menus>
46-
46+
4747
<!-- In this section you can define new menu groups. A menu group is a container for
4848
other menus or buttons (commands); from a visual point of view you can see the
4949
group as the part of a menu contained between two lines. The parent of a group
@@ -92,7 +92,7 @@
9292
<ButtonText>Build, Deploy and Debug</ButtonText>
9393
</Strings>
9494
</Button>
95-
95+
9696
<Button guid="GuidLinuxDebugerMenu" id="CmdDebugOnly" priority="0x0402" type="Button">
9797
<Parent guid="GuidLinuxDebugerMenu" id="RemoteMainMenuGroupLevel1" />
9898
<CommandFlag>DynamicVisibility</CommandFlag>
@@ -103,6 +103,10 @@
103103
</Strings>
104104
</Button>
105105

106+
<!--
107+
TODO: Publish & Publish and Debug
108+
-->
109+
106110
<Button guid="GuidLinuxDebugerMenu" id="CmdOpenLogs" priority="0x0500" type="Button">
107111
<Parent guid="GuidLinuxDebugerMenu" id="RemoteMainMenuGroupLevel2" />
108112
<CommandFlag>DynamicVisibility</CommandFlag>
@@ -124,7 +128,6 @@
124128
<ButtonText>Settings</ButtonText>
125129
</Strings>
126130
</Button>
127-
128131
</Buttons>
129132

130133
<!--The bitmaps section is used to define the bitmaps that are used for the commands.-->
@@ -165,24 +168,24 @@
165168
<IDSymbol name="CmdOpenLogs" value="0x1004" />
166169
<IDSymbol name="CmdOpenSettings" value="0x1005" />
167170
</GuidSymbol>
168-
169-
<GuidSymbol name="DeployAndDebug_16x" value="{B3A9DD89-C898-4AFE-AC48-3A4C84122475}" >
171+
172+
<GuidSymbol name="DeployAndDebug_16x" value="{B3A9DD89-C898-4AFE-AC48-3A4C84122475}">
170173
<IDSymbol name="imgDeployAndDebug" value="1" />
171174
</GuidSymbol>
172-
173-
<GuidSymbol name="DeployOnly_16x" value="{00AD8C85-F4CF-4EFA-8C8E-3ADE51071088}" >
175+
176+
<GuidSymbol name="DeployOnly_16x" value="{00AD8C85-F4CF-4EFA-8C8E-3ADE51071088}">
174177
<IDSymbol name="imgDeployOnly" value="1" />
175178
</GuidSymbol>
176179

177-
<GuidSymbol name="DebugOnly_16x" value="{0164DE8A-8EAB-40CE-9607-C6D15882A91A}" >
180+
<GuidSymbol name="DebugOnly_16x" value="{0164DE8A-8EAB-40CE-9607-C6D15882A91A}">
178181
<IDSymbol name="imgDebugOnly" value="1" />
179182
</GuidSymbol>
180183

181-
<GuidSymbol name="ShowLog_16x" value="{5B4A8C21-9884-4A10-B028-1BC98C324B10}" >
184+
<GuidSymbol name="ShowLog_16x" value="{5B4A8C21-9884-4A10-B028-1BC98C324B10}">
182185
<IDSymbol name="imgShowLog" value="1" />
183186
</GuidSymbol>
184-
185-
<GuidSymbol name="Settings_16x" value="{AFAE921E-9A65-44E9-90CE-022DB84EE5BB}" >
187+
188+
<GuidSymbol name="Settings_16x" value="{AFAE921E-9A65-44E9-90CE-022DB84EE5BB}">
186189
<IDSymbol name="imgSettings" value="1" />
187190
</GuidSymbol>
188191

src/VsLinuxDebugger/OptionsPages/OptionsPage.Ssh.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ public partial class OptionsPage : DialogPage
1010
private const string Credientials = "Remote Credientials";
1111

1212
[Category(Credientials)]
13-
[DisplayName("IP Address")]
14-
[Description("IP Address")]
13+
[DisplayName("Host IP Address")]
14+
[Description("Host IP Address. On VMs using 'NAT', set IP to '127.0.0.1' and forward Port 22. PCs and VMs 'Bridged', have their own IP.")]
1515
public string HostIp { get; set; } = "127.0.0.1";
1616

1717
[Category(Credientials)]

0 commit comments

Comments
 (0)