From 3e01ffbe510c10866a2a18cdece0d37ebfd9cf0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matija=20Ko=C5=BEelj?= Date: Wed, 4 Jan 2023 15:47:41 +0100 Subject: [PATCH] Add automatic versioning to Connected.Host Add automatic nuget build to Connected.Host Build Connected.Host as nuget tool --- nuget.config | 17 +++++++ src/Connected.Host/Connected.Host.csproj | 63 ++++++++++++++++++------ src/Connected.Host/Program.cs | 3 +- src/Connected.Host/version.json | 14 ++++++ 4 files changed, 82 insertions(+), 15 deletions(-) create mode 100644 nuget.config create mode 100644 src/Connected.Host/version.json diff --git a/nuget.config b/nuget.config new file mode 100644 index 0000000..cf4c076 --- /dev/null +++ b/nuget.config @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Connected.Host/Connected.Host.csproj b/src/Connected.Host/Connected.Host.csproj index 089c444..97ac19d 100644 --- a/src/Connected.Host/Connected.Host.csproj +++ b/src/Connected.Host/Connected.Host.csproj @@ -1,18 +1,53 @@ - + - - net7.0 - enable - enable - + + net7.0 + enable + enable + true + true + connected + true + $(AssemblyName) + Tom PIT ltd + 2022 Tom PIT ltd + https://git.tompit.com/Connected/Info + README.md + connected;platform; + True + snupkg + LICENSE + $(OutputPath) + - - - - - - - - + + + + + + + + + + + + + + True + \ + + + True + \ + + + + + + + diff --git a/src/Connected.Host/Program.cs b/src/Connected.Host/Program.cs index 2c935aa..9e0994f 100644 --- a/src/Connected.Host/Program.cs +++ b/src/Connected.Host/Program.cs @@ -1,3 +1,4 @@ +using System.Reflection; using Connected.Host.Configuration; namespace Connected.Host @@ -10,7 +11,7 @@ namespace Connected.Host .CreateDefaultBuilder(args) .ConfigureAppConfiguration((_, cfg) => { - var appPath = AppContext.BaseDirectory; + var appPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var segments = new Uri(appPath).Segments; segments = segments.Select(e => e.Replace("%20", " ")).ToArray(); diff --git a/src/Connected.Host/version.json b/src/Connected.Host/version.json new file mode 100644 index 0000000..2a1593f --- /dev/null +++ b/src/Connected.Host/version.json @@ -0,0 +1,14 @@ +{ + "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json", + "version": "1.0-prerelease", + "semVer1NumericIdentifierPadding": 4, + "nugetPackageVersion": { + "semVer": 2, // optional. Set to either 1 or 2 to control how the NuGet package version string is generated. Default is 1. + "precision": "build" // optional. Use when you want to use a more or less precise package version than the default major.minor.build. + }, + "cloudBuild": { + "buildNumber": { + "enabled": true + } + } +} \ No newline at end of file