Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions RaspberryDebugger/Commands/DebugStartCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ private async void Execute(object sender, EventArgs e)
if (!projectProperties.IsAspNet || !projectProperties.AspLaunchBrowser)
return;

var baseUri = $"http://{connection.Name}.local";
var baseUri = $"http://{connection.Name}";
var launchReady = false;

await NeonHelper.WaitForAsync(
Expand All @@ -180,7 +180,7 @@ await NeonHelper.WaitForAsync(
{
var appListeningScript =
$@"
if lsof -i -P -n | grep --quiet 'TCP 127.0.0.1:{projectProperties.AspPort}' ; then
if lsof -i -P -n | grep -q 'TCP 127.0.0.1:{projectProperties.AspPort}\|TCP 0.0.0.0:{projectProperties.AspPort}\|TCP \*:{projectProperties.AspPort}' ; then
exit 0
else
exit 1
Expand Down Expand Up @@ -212,7 +212,7 @@ exit 1

if (launchReady)
{
NeonHelper.OpenBrowser($"{baseUri}{projectProperties.AspRelativeBrowserUri}");
NeonHelper.OpenBrowser($"{baseUri}:{projectProperties.AspPort}/{projectProperties.AspRelativeBrowserUri}");
}
}
}
Expand Down Expand Up @@ -277,7 +277,7 @@ private async Task<TempFile> CreateLaunchSettingsAsync(ConnectionInfo connection

if (projectProperties?.IsAspNet == true)
{
environmentVariables["ASPNETCORE_URLS"] = $"http://127.0.0.1:{projectProperties.AspPort}";
environmentVariables["ASPNETCORE_URLS"] = $"http://0.0.0.0:{projectProperties.AspPort}";
}

// Construct the debug launch JSON file.
Expand All @@ -288,6 +288,7 @@ private async Task<TempFile> CreateLaunchSettingsAsync(ConnectionInfo connection
// sees from Visual Studio for debugging purposes. The log file
// is persisted to the program folder on the Raspberry.


engineLogging = $"--engineLogging={debugFolder}/__vsdbg-log.txt";
#endif
var settings =
Expand Down
30 changes: 27 additions & 3 deletions RaspberryDebugger/Models/VisualStudio/ProjectProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,17 +173,17 @@ public static ProjectProperties CopyFrom(Solution solution, EnvDTE.Project proje
}

// Extract additional settings for ASPNET projects.
if (settings.Property("iisSettings") == null) continue;
var jProperty = profileObject.Property("applicationUrl");
if (jProperty == null) continue;

isAspNet = true;

// Note that we're going to fall back to port 5000 if there are any
// issues parsing the application URL.
const int fallbackPort = 5000;

var jProperty = profileObject.Property("applicationUrl");

if (jProperty != null && jProperty.Value.Type == JTokenType.String)
if (jProperty.Value.Type == JTokenType.String)
{
try
{
Expand Down Expand Up @@ -212,6 +212,30 @@ public static ProjectProperties CopyFrom(Solution solution, EnvDTE.Project proje
{
aspLaunchBrowser = (bool)jProperty.Value;
}

jProperty = profileObject.Property("launchUrl");

if (jProperty == null ||
jProperty.Value.Type != JTokenType.String)
continue;

var launchUri = (string)jProperty.Value;

if (string.IsNullOrEmpty(launchUri)) continue;

try
{
var uri = new Uri(launchUri, UriKind.RelativeOrAbsolute);

aspRelativeBrowserUri = uri.IsAbsoluteUri
? uri.PathAndQuery
: launchUri;
}
catch
{
// We'll fall back to "/" for any URI parsing errors.
aspRelativeBrowserUri = "/";
}
}
else if (profile.Name == "IIS Express")
{
Expand Down
10 changes: 8 additions & 2 deletions Test/Blinkie/Blinky.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30523.141
# Visual Studio Version 17
VisualStudioVersion = 17.2.32616.157
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blinkie", "Blinkie\Blinkie.csproj", "{B1E5A334-F139-496D-ACF7-1CCB6840DACA}"
EndProject
Expand All @@ -19,6 +19,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blinkie31", "Blinkie31\Blin
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionFolder", "SolutionFolder", "{F415615A-B38A-49E0-8296-D81F9B97E352}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebApi", "WebApi\WebApi.csproj", "{A3D15A5D-3BB4-4E93-BDFD-711BC97B1374}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -49,6 +51,10 @@ Global
{6EEFF8C7-49AA-4A94-84DA-B7E9CAE34160}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6EEFF8C7-49AA-4A94-84DA-B7E9CAE34160}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6EEFF8C7-49AA-4A94-84DA-B7E9CAE34160}.Release|Any CPU.Build.0 = Release|Any CPU
{A3D15A5D-3BB4-4E93-BDFD-711BC97B1374}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A3D15A5D-3BB4-4E93-BDFD-711BC97B1374}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A3D15A5D-3BB4-4E93-BDFD-711BC97B1374}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A3D15A5D-3BB4-4E93-BDFD-711BC97B1374}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
33 changes: 33 additions & 0 deletions Test/Blinkie/WebApi/Controllers/WeatherForecastController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using Microsoft.AspNetCore.Mvc;

namespace WebApi.Controllers
{
[ApiController]
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};

private readonly ILogger<WeatherForecastController> _logger;

public WeatherForecastController(ILogger<WeatherForecastController> logger)
{
_logger = logger;
}

[HttpGet(Name = "GetWeatherForecast")]
public IEnumerable<WeatherForecast> Get()
{
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = DateTime.Now.AddDays(index),
TemperatureC = Random.Shared.Next(-20, 55),
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
})
.ToArray();
}
}
}
25 changes: 25 additions & 0 deletions Test/Blinkie/WebApi/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
var builder = WebApplication.CreateBuilder(args);

// Add services to the container.

builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();

var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}

app.UseHttpsRedirection();

app.UseAuthorization();

app.MapControllers();

app.Run();
15 changes: 15 additions & 0 deletions Test/Blinkie/WebApi/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": {
"WebApi": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5098",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
13 changes: 13 additions & 0 deletions Test/Blinkie/WebApi/WeatherForecast.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace WebApi
{
public class WeatherForecast
{
public DateTime Date { get; set; }

public int TemperatureC { get; set; }

public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);

public string? Summary { get; set; }
}
}
15 changes: 15 additions & 0 deletions Test/Blinkie/WebApi/WebApi.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RuntimeIdentifier>linux-arm</RuntimeIdentifier>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
</ItemGroup>

</Project>
8 changes: 8 additions & 0 deletions Test/Blinkie/WebApi/appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
9 changes: 9 additions & 0 deletions Test/Blinkie/WebApi/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}
8 changes: 0 additions & 8 deletions Test/Blinkie/WebApp/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "http://localhost:5000/Privacy",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"WebApp": {
"commandName": "Project",
"launchBrowser": true,
Expand Down
2 changes: 2 additions & 0 deletions Test/Blinkie/WebApp/WebApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<RuntimeIdentifier>linux-arm</RuntimeIdentifier>
<PlatformTarget>AnyCPU</PlatformTarget>
<SignAssembly>True</SignAssembly>
</PropertyGroup>
</Project>