From 243cb0f9df15d3003793494bd21744d97b483251 Mon Sep 17 00:00:00 2001 From: dovholuknf <46322585+dovholuknf@users.noreply.github.com> Date: Fri, 19 Apr 2024 14:26:17 -0400 Subject: [PATCH] fix samples when running vs 1.+. update readme and project for spec dl. handle dotnet run better --- OpenZiti.Management/OpenZiti.Management.csproj | 2 +- OpenZiti.Management/README.md | 4 +++- OpenZiti.Management/management.yml | 1 + OpenZiti.NET.Samples/src/Program.cs | 11 ++++++++++- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/OpenZiti.Management/OpenZiti.Management.csproj b/OpenZiti.Management/OpenZiti.Management.csproj index 3a3ef838..1a95fa89 100644 --- a/OpenZiti.Management/OpenZiti.Management.csproj +++ b/OpenZiti.Management/OpenZiti.Management.csproj @@ -6,7 +6,7 @@ enable - + diff --git a/OpenZiti.Management/README.md b/OpenZiti.Management/README.md index 962c9ec9..13c26e61 100644 --- a/OpenZiti.Management/README.md +++ b/OpenZiti.Management/README.md @@ -2,5 +2,7 @@ This project exists as a C# implementation of the OpenZiti management API spec. Open the .csproj to see how it works. It basically runs a powershell command to pull down the spec from a predefined url, caching it. You can run that -msbuild target with something like `dotnet build /t:DownloadMgmtYaml` to refresh the spec. +msbuild target with something like +`dotnet build /t:DownloadMgmtYaml /p:ManagementSpecUrl=https://localhost:1280/edge/management/v1/specs/edge-management/spec` +to refresh the spec. Replace the url with the expected url. diff --git a/OpenZiti.Management/management.yml b/OpenZiti.Management/management.yml index a49a7e2c..d7674d52 100644 --- a/OpenZiti.Management/management.yml +++ b/OpenZiti.Management/management.yml @@ -13920,6 +13920,7 @@ definitions: enum: - Dial - Bind + - Invalid dialBindArray: type: array items: diff --git a/OpenZiti.NET.Samples/src/Program.cs b/OpenZiti.NET.Samples/src/Program.cs index 44ffa4ac..79e74870 100644 --- a/OpenZiti.NET.Samples/src/Program.cs +++ b/OpenZiti.NET.Samples/src/Program.cs @@ -16,6 +16,7 @@ limitations under the License. using OpenZiti.Debugging; using System; +using System.Linq; using System.Reflection; using System.Threading.Tasks; using MLog = Microsoft.Extensions.Logging; @@ -30,7 +31,7 @@ private static async Task Main(string[] args) { //try { Console.Clear(); } catch (Exception) { /*ignore exceptions*/ } LoggingHelper.LogToConsole(MLog.LogLevel.Trace); API.NativeLogger = API.DefaultNativeLogFunction; - + var currentAssembly = Assembly.GetExecutingAssembly(); if (args == null || args.Length < 1) { Console.WriteLine("These samples expect a parameter indicating which sample to run."); @@ -47,6 +48,14 @@ private static async Task Main(string[] args) { return; } + if ( args[0].Contains(AppDomain.CurrentDomain.FriendlyName )) { + Console.WriteLine("args[0] contains the AppDomain.CurrentDomain.FriendlyName, must be using dotnet run: "); + Array.ForEach(args, Console.WriteLine); + args = args.Skip(1).ToArray(); + } else { + Console.WriteLine(AppDomain.CurrentDomain.FriendlyName); + } + if (args.Length > 1) { SampleSetup.Initialize = (args[1]?.ToLower().Trim() != "noinit"); if (args.Length > 2) {