Skip to content

Commit

Permalink
Merge pull request #5 from tryphotino/debug
Browse files Browse the repository at this point in the history
Debug
  • Loading branch information
MikeYeager authored Aug 15, 2024
2 parents 0a545a0 + fe24d77 commit 64d4364
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 43 deletions.
27 changes: 19 additions & 8 deletions Photino.NET.Server/PhotinoServer.NET.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.IO;
using System.Linq;
using System.Net.NetworkInformation;
using Microsoft.AspNetCore.Builder;
Expand Down Expand Up @@ -39,17 +40,26 @@ public static WebApplication CreateStaticFileServer(
WebRootPath = webRootFolder
});

var manifestEmbeddedFileProvider =
new ManifestEmbeddedFileProvider(
System.Reflection.Assembly.GetEntryAssembly(),
$"Resources/{webRootFolder}");
string embeddedResourcePath = $"Resources/{webRootFolder}";

var physicalFileProvider = builder.Environment.WebRootFileProvider;
if (Directory.Exists(embeddedResourcePath))
{
var manifestEmbeddedFileProvider =
new ManifestEmbeddedFileProvider(
System.Reflection.Assembly.GetEntryAssembly(),
embeddedResourcePath);

var physicalFileProvider = builder.Environment.WebRootFileProvider;

CompositeFileProvider compositeWebProvider
= new(manifestEmbeddedFileProvider, physicalFileProvider);
CompositeFileProvider compositeWebProvider
= new(manifestEmbeddedFileProvider, physicalFileProvider);

builder.Environment.WebRootFileProvider = compositeWebProvider;
builder.Environment.WebRootFileProvider = compositeWebProvider;
}
else
{
Console.Error.WriteLine($"The folder {webRootFolder} already exists. Please remove it before running the server.");
}

int port = startPort;

Expand All @@ -72,6 +82,7 @@ CompositeFileProvider compositeWebProvider
builder.WebHost.UseUrls(baseUrl);

WebApplication app = builder.Build();
app.UseDefaultFiles();
app.UseStaticFiles(new StaticFileOptions
{
DefaultContentType = "text/plain"
Expand Down
12 changes: 12 additions & 0 deletions Photino.NET.Server/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"profiles": {
"Photino.NET.Server": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:56821;http://localhost:56822"
}
}
}
2 changes: 1 addition & 1 deletion azure-pipelines-photino.net.server-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
displayName: 'Use .NET Core sdk'
inputs:
packageType: sdk
version: 6.0.x
version: 8.0.x
installationPath: $(Agent.ToolsDirectory)/dotnet

- task: NuGetAuthenticate@1
Expand Down
68 changes: 34 additions & 34 deletions azure-pipelines-photino.net.server-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,46 @@
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core

trigger:
- manual
- manual

variables:
major: 1
minor: 0
minor: 2
patch: $[counter(variables['minor'], 0)] #this will reset when we bump minor
buildConfiguration: 'Release'
buildConfiguration: "Release"

jobs:
- job: 'BuildPackageAndPublish'
- job: "BuildPackageAndPublish"

pool:
vmImage: windows-latest
pool:
vmImage: windows-latest

steps:
- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
packageType: sdk
version: 8.0.x
installationPath: $(Agent.ToolsDirectory)/dotnet
steps:
- task: UseDotNet@2
displayName: "Use .NET Core sdk"
inputs:
packageType: sdk
version: 8.0.x
installationPath: $(Agent.ToolsDirectory)/dotnet

#Build and Create NuGet package
- task: CmdLine@2
displayName: "Build and Create NuGet package"
inputs:
script: "dotnet pack Photino.NET.Server/Photino.NET.Server.csproj -c $(buildConfiguration) /p:Version=$(major).$(minor).$(patch) /p:PackageVersion=$(major).$(minor).$(patch)"

#Build and Create NuGet package
- task: CmdLine@2
displayName: 'Build and Create NuGet package'
inputs:
script: 'dotnet pack Photino.NET.Server/Photino.NET.Server.csproj -c $(buildConfiguration) /p:Version=$(major).$(minor).$(patch) /p:PackageVersion=$(major).$(minor).$(patch)'

# Uploads the NuGet package file to nuget.org
# Important notes:
# 1. For this to work, you need to create a 'service connection' with the same name
# as the 'publishFeedCredentials' value.
# 2. For security, you *must* ensure that 'Make secrets available to builds of forks'
# is disabled in your PR validation settings (inside build -> Edit -> Triggers).
# Otherwise, PRs would be able to push new packages even without being merged.
- task: NuGetCommand@2
displayName: 'Publish to nuget.org'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
inputs:
command: push
packagesToPush: 'Photino.NET.Server/bin/$(buildConfiguration)/*.nupkg'
nuGetFeedType: external
publishFeedCredentials: 'PhotinoNetNuGet'
# Uploads the NuGet package file to nuget.org
# Important notes:
# 1. For this to work, you need to create a 'service connection' with the same name
# as the 'publishFeedCredentials' value.
# 2. For security, you *must* ensure that 'Make secrets available to builds of forks'
# is disabled in your PR validation settings (inside build -> Edit -> Triggers).
# Otherwise, PRs would be able to push new packages even without being merged.
- task: NuGetCommand@2
displayName: "Publish to nuget.org"
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
inputs:
command: push
packagesToPush: "Photino.NET.Server/bin/$(buildConfiguration)/*.nupkg"
nuGetFeedType: external
publishFeedCredentials: "PhotinoNetNuGet"

0 comments on commit 64d4364

Please sign in to comment.