From 6ce67451c9669df014cf00fa4a675361a77d0cd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Roux?= <42benoit.roux@gmail.com> Date: Tue, 24 Mar 2026 15:40:31 +0100 Subject: [PATCH 1/2] Make solution buiild for .net 8.0 and remove nuke from build to use dotnet build instead --- .nuke | 1 - AlphaVSS.sln | 90 +++--- azure-pipelines.yml | 32 -- build.ps1 | 68 ----- build/Build.cs | 276 ------------------ build/Properties/launchSettings.json | 8 - build/VSWhereResult2.cs | 49 ---- build/_build.csproj | 53 ---- build/_build.csproj.DotSettings | 24 -- build/nuget/AlphaVSS.Native.NetCore.nuspec | 16 +- build/nuget/AlphaVSS.Native.NetFx.nuspec | 12 +- build/nuget/AlphaVSS.nuspec | 22 +- global.json | 6 - src/AlphaVSS.Common/AlphaVSS.Common.csproj | 7 +- .../Classes/VssFactoryProvider.cs | 3 +- .../Resources/LocalizedStrings.Designer.cs | 2 +- .../AlphaVSS.Platform - Copy.vcxproj | 232 --------------- src/AlphaVSS.Platform/AlphaVSS.Platform.props | 4 +- .../AlphaVSS.Platform.vcxproj | 161 ++++------ src/AlphaVSS.Platform/VssBackupComponents.cpp | 1 - .../VssExamineWriterMetadata.h | 3 +- 21 files changed, 126 insertions(+), 944 deletions(-) delete mode 100644 .nuke delete mode 100644 azure-pipelines.yml delete mode 100644 build.ps1 delete mode 100644 build/Build.cs delete mode 100644 build/Properties/launchSettings.json delete mode 100644 build/VSWhereResult2.cs delete mode 100644 build/_build.csproj delete mode 100644 build/_build.csproj.DotSettings delete mode 100644 global.json delete mode 100644 src/AlphaVSS.Platform/AlphaVSS.Platform - Copy.vcxproj diff --git a/.nuke b/.nuke deleted file mode 100644 index 6f60bb5d..00000000 --- a/.nuke +++ /dev/null @@ -1 +0,0 @@ -AlphaVSS.sln \ No newline at end of file diff --git a/AlphaVSS.sln b/AlphaVSS.sln index 7eb8c766..53cbe068 100644 --- a/AlphaVSS.sln +++ b/AlphaVSS.sln @@ -1,18 +1,20 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29505.145 +# Visual Studio Version 18 +VisualStudioVersion = 18.4.11612.150 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2D2D5045-46A9-490F-A79D-78B261C35231}" ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig - src\AlphaVSS.nuspec = src\AlphaVSS.nuspec + build\nuget\AlphaVSS.Native.NetCore.nuspec = build\nuget\AlphaVSS.Native.NetCore.nuspec + build\nuget\AlphaVSS.Native.NetFx.nuspec = build\nuget\AlphaVSS.Native.NetFx.nuspec + build\nuget\AlphaVSS.Native.NetFx.targets = build\nuget\AlphaVSS.Native.NetFx.targets + build\nuget\AlphaVSS.nuspec = build\nuget\AlphaVSS.nuspec src\AlphaVSS.props = src\AlphaVSS.props azure-pipelines.yml = azure-pipelines.yml CHANGELOG.md = CHANGELOG.md docs\docfx.json = docs\docfx.json GitVersion.yml = GitVersion.yml - global.json = global.json EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AlphaVSS.Common", "src\AlphaVSS.Common\AlphaVSS.Common.csproj", "{2276E222-6841-4DA9-B5C9-549E9ADB33BE}" @@ -22,60 +24,40 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AlphaVSS.Platform", "src\Al {2276E222-6841-4DA9-B5C9-549E9ADB33BE} = {2276E222-6841-4DA9-B5C9-549E9ADB33BE} EndProjectSection EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "_build", "build\_build.csproj", "{8FFBC249-EDAC-40EA-84A4-FCB66D579A1A}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - core31|x64 = core31|x64 - core31|x86 = core31|x86 - core31d|x64 = core31d|x64 - core31d|x86 = core31d|x86 - net45|x64 = net45|x64 - net45|x86 = net45|x86 - net45d|x64 = net45d|x64 - net45d|x86 = net45d|x86 + NET8|ARM64 = NET8|ARM64 + NET8|x64 = NET8|x64 + NET8|x86 = NET8|x86 + net8d|ARM64 = net8d|ARM64 + net8d|x64 = net8d|x64 + net8d|x86 = net8d|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {2276E222-6841-4DA9-B5C9-549E9ADB33BE}.core31|x64.ActiveCfg = Release|Any CPU - {2276E222-6841-4DA9-B5C9-549E9ADB33BE}.core31|x64.Build.0 = Release|Any CPU - {2276E222-6841-4DA9-B5C9-549E9ADB33BE}.core31|x86.ActiveCfg = Release|Any CPU - {2276E222-6841-4DA9-B5C9-549E9ADB33BE}.core31|x86.Build.0 = Release|Any CPU - {2276E222-6841-4DA9-B5C9-549E9ADB33BE}.core31d|x64.ActiveCfg = Debug|Any CPU - {2276E222-6841-4DA9-B5C9-549E9ADB33BE}.core31d|x64.Build.0 = Debug|Any CPU - {2276E222-6841-4DA9-B5C9-549E9ADB33BE}.core31d|x86.ActiveCfg = Debug|Any CPU - {2276E222-6841-4DA9-B5C9-549E9ADB33BE}.core31d|x86.Build.0 = Debug|Any CPU - {2276E222-6841-4DA9-B5C9-549E9ADB33BE}.net45|x64.ActiveCfg = Release|Any CPU - {2276E222-6841-4DA9-B5C9-549E9ADB33BE}.net45|x64.Build.0 = Release|Any CPU - {2276E222-6841-4DA9-B5C9-549E9ADB33BE}.net45|x86.ActiveCfg = Release|Any CPU - {2276E222-6841-4DA9-B5C9-549E9ADB33BE}.net45|x86.Build.0 = Release|Any CPU - {2276E222-6841-4DA9-B5C9-549E9ADB33BE}.net45d|x64.ActiveCfg = Debug|Any CPU - {2276E222-6841-4DA9-B5C9-549E9ADB33BE}.net45d|x64.Build.0 = Debug|Any CPU - {2276E222-6841-4DA9-B5C9-549E9ADB33BE}.net45d|x86.ActiveCfg = Debug|Any CPU - {2276E222-6841-4DA9-B5C9-549E9ADB33BE}.net45d|x86.Build.0 = Debug|Any CPU - {3A977469-6361-469C-B180-5180CD9A15B4}.core31|x64.ActiveCfg = core31|x64 - {3A977469-6361-469C-B180-5180CD9A15B4}.core31|x64.Build.0 = core31|x64 - {3A977469-6361-469C-B180-5180CD9A15B4}.core31|x86.ActiveCfg = core31|Win32 - {3A977469-6361-469C-B180-5180CD9A15B4}.core31|x86.Build.0 = core31|Win32 - {3A977469-6361-469C-B180-5180CD9A15B4}.core31d|x64.ActiveCfg = core31d|x64 - {3A977469-6361-469C-B180-5180CD9A15B4}.core31d|x64.Build.0 = core31d|x64 - {3A977469-6361-469C-B180-5180CD9A15B4}.core31d|x86.ActiveCfg = core31d|Win32 - {3A977469-6361-469C-B180-5180CD9A15B4}.core31d|x86.Build.0 = core31d|Win32 - {3A977469-6361-469C-B180-5180CD9A15B4}.net45|x64.ActiveCfg = net45|x64 - {3A977469-6361-469C-B180-5180CD9A15B4}.net45|x64.Build.0 = net45|x64 - {3A977469-6361-469C-B180-5180CD9A15B4}.net45|x86.ActiveCfg = net45|Win32 - {3A977469-6361-469C-B180-5180CD9A15B4}.net45|x86.Build.0 = net45|Win32 - {3A977469-6361-469C-B180-5180CD9A15B4}.net45d|x64.ActiveCfg = net45d|x64 - {3A977469-6361-469C-B180-5180CD9A15B4}.net45d|x64.Build.0 = net45d|x64 - {3A977469-6361-469C-B180-5180CD9A15B4}.net45d|x86.ActiveCfg = net45d|Win32 - {3A977469-6361-469C-B180-5180CD9A15B4}.net45d|x86.Build.0 = net45d|Win32 - {8FFBC249-EDAC-40EA-84A4-FCB66D579A1A}.core31|x64.ActiveCfg = Debug|Any CPU - {8FFBC249-EDAC-40EA-84A4-FCB66D579A1A}.core31|x86.ActiveCfg = Debug|Any CPU - {8FFBC249-EDAC-40EA-84A4-FCB66D579A1A}.core31d|x64.ActiveCfg = Debug|Any CPU - {8FFBC249-EDAC-40EA-84A4-FCB66D579A1A}.core31d|x86.ActiveCfg = Debug|Any CPU - {8FFBC249-EDAC-40EA-84A4-FCB66D579A1A}.net45|x64.ActiveCfg = Debug|Any CPU - {8FFBC249-EDAC-40EA-84A4-FCB66D579A1A}.net45|x86.ActiveCfg = Debug|Any CPU - {8FFBC249-EDAC-40EA-84A4-FCB66D579A1A}.net45d|x64.ActiveCfg = Debug|Any CPU - {8FFBC249-EDAC-40EA-84A4-FCB66D579A1A}.net45d|x86.ActiveCfg = Debug|Any CPU + {2276E222-6841-4DA9-B5C9-549E9ADB33BE}.NET8|ARM64.ActiveCfg = Release|Any CPU + {2276E222-6841-4DA9-B5C9-549E9ADB33BE}.NET8|ARM64.Build.0 = Release|Any CPU + {2276E222-6841-4DA9-B5C9-549E9ADB33BE}.NET8|x64.ActiveCfg = Release|Any CPU + {2276E222-6841-4DA9-B5C9-549E9ADB33BE}.NET8|x64.Build.0 = Release|Any CPU + {2276E222-6841-4DA9-B5C9-549E9ADB33BE}.NET8|x86.ActiveCfg = Release|Any CPU + {2276E222-6841-4DA9-B5C9-549E9ADB33BE}.NET8|x86.Build.0 = Release|Any CPU + {2276E222-6841-4DA9-B5C9-549E9ADB33BE}.net8d|ARM64.ActiveCfg = Debug|Any CPU + {2276E222-6841-4DA9-B5C9-549E9ADB33BE}.net8d|ARM64.Build.0 = Debug|Any CPU + {2276E222-6841-4DA9-B5C9-549E9ADB33BE}.net8d|x64.ActiveCfg = Debug|Any CPU + {2276E222-6841-4DA9-B5C9-549E9ADB33BE}.net8d|x64.Build.0 = Debug|Any CPU + {2276E222-6841-4DA9-B5C9-549E9ADB33BE}.net8d|x86.ActiveCfg = Debug|Any CPU + {2276E222-6841-4DA9-B5C9-549E9ADB33BE}.net8d|x86.Build.0 = Debug|Any CPU + {3A977469-6361-469C-B180-5180CD9A15B4}.NET8|ARM64.ActiveCfg = net8|ARM64 + {3A977469-6361-469C-B180-5180CD9A15B4}.NET8|ARM64.Build.0 = net8|ARM64 + {3A977469-6361-469C-B180-5180CD9A15B4}.NET8|x64.ActiveCfg = net8|x64 + {3A977469-6361-469C-B180-5180CD9A15B4}.NET8|x64.Build.0 = net8|x64 + {3A977469-6361-469C-B180-5180CD9A15B4}.NET8|x86.ActiveCfg = net8|Win32 + {3A977469-6361-469C-B180-5180CD9A15B4}.NET8|x86.Build.0 = net8|Win32 + {3A977469-6361-469C-B180-5180CD9A15B4}.net8d|ARM64.ActiveCfg = net8d|ARM64 + {3A977469-6361-469C-B180-5180CD9A15B4}.net8d|ARM64.Build.0 = net8d|ARM64 + {3A977469-6361-469C-B180-5180CD9A15B4}.net8d|x64.ActiveCfg = net8d|x64 + {3A977469-6361-469C-B180-5180CD9A15B4}.net8d|x64.Build.0 = net8d|x64 + {3A977469-6361-469C-B180-5180CD9A15B4}.net8d|x86.ActiveCfg = net8d|Win32 + {3A977469-6361-469C-B180-5180CD9A15B4}.net8d|x86.Build.0 = net8d|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 96556eca..00000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,32 +0,0 @@ -# Starter pipeline -# Start with a minimal pipeline that you can customize to build and deploy your code. -# Add steps that build, run tests, deploy, and more: -# https://aka.ms/yaml - - -trigger: -- master - -pool: - name: Default -# vmImage: 'windows-latest' - -jobs: -- job: Nuke - displayName: Nuke - workspace: - clean: all - steps: - - task: UseDotNet@2 - inputs: - packageType: 'sdk' - useGlobalJson: true - performMultiLevelLookup: true -# - - - task: PowerShell@2 - inputs: - displayName: 'Nuke Build' - filePath: '$(Build.SourcesDirectory)/build.ps1' - arguments: '--target distbuild' - workingDirectory: '$(Build.SourcesDirectory)' \ No newline at end of file diff --git a/build.ps1 b/build.ps1 deleted file mode 100644 index 5fa4ce59..00000000 --- a/build.ps1 +++ /dev/null @@ -1,68 +0,0 @@ -[CmdletBinding()] -Param( - [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)] - [string[]]$BuildArguments -) - -Write-Output "PowerShell $($PSVersionTable.PSEdition) version $($PSVersionTable.PSVersion)" - -Set-StrictMode -Version 2.0; $ErrorActionPreference = "Stop"; $ConfirmPreference = "None"; trap { exit 1 } -$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent - -########################################################################### -# CONFIGURATION -########################################################################### - -$BuildProjectFile = "$PSScriptRoot\build\_build.csproj" -$TempDirectory = "$PSScriptRoot\\.tmp" - -$DotNetGlobalFile = "$PSScriptRoot\\global.json" -$DotNetInstallUrl = "https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.ps1" -$DotNetChannel = "Current" - -$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1 -$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1 - -########################################################################### -# EXECUTION -########################################################################### - -function ExecSafe([scriptblock] $cmd) { - & $cmd - if ($LASTEXITCODE) { exit $LASTEXITCODE } -} - -# If global.json exists, load expected version -if (Test-Path $DotNetGlobalFile) { - $DotNetGlobal = $(Get-Content $DotNetGlobalFile | Out-String | ConvertFrom-Json) - if ($DotNetGlobal.PSObject.Properties["sdk"] -and $DotNetGlobal.sdk.PSObject.Properties["version"]) { - $DotNetVersion = $DotNetGlobal.sdk.version - } -} - -# If dotnet is installed locally, and expected version is not set or installation matches the expected version -if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue) -and ` - (!(Test-Path variable:DotNetVersion) -or $(& dotnet --version) -eq $DotNetVersion)) { - $env:DOTNET_EXE = (Get-Command "dotnet").Path -} -else { - $DotNetDirectory = "$TempDirectory\dotnet-win" - $env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe" - - # Download install script - $DotNetInstallFile = "$TempDirectory\dotnet-install.ps1" - New-Item -ItemType Directory -Path $TempDirectory | Out-Null - (New-Object System.Net.WebClient).DownloadFile($DotNetInstallUrl, $DotNetInstallFile) - - # Install by channel or version - if (!(Test-Path variable:DotNetVersion)) { - ExecSafe { & $DotNetInstallFile -InstallDir $DotNetDirectory -Channel $DotNetChannel -NoPath } - } else { - ExecSafe { & $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath } - } -} - -Write-Output "Microsoft (R) .NET Core SDK version $(& $env:DOTNET_EXE --version)" - -ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false } -ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile --no-build -- $BuildArguments } diff --git a/build/Build.cs b/build/Build.cs deleted file mode 100644 index 534ea0be..00000000 --- a/build/Build.cs +++ /dev/null @@ -1,276 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using Newtonsoft.Json; -using Nuke.Common; -using Nuke.Common.Execution; -using Nuke.Common.Git; -using Nuke.Common.IO; -using Nuke.Common.ProjectModel; -using Nuke.Common.Tooling; -using Nuke.Common.Tools.DotNet; -using Nuke.Common.Tools.GitVersion; -using Nuke.Common.Tools.MSBuild; -using Nuke.Common.Tools.VSWhere; -using Nuke.Common.Tools.NuGet; -using Nuke.Common.Utilities; -using Nuke.Common.Utilities.Collections; -using static Nuke.Common.EnvironmentInfo; -using static Nuke.Common.IO.FileSystemTasks; -using static Nuke.Common.Tools.NuGet.NuGetTasks; -using Nuke.DocFX; -using static Nuke.Common.IO.PathConstruction; -using static Nuke.Common.Tools.MSBuild.MSBuildTasks; -using Nuke.Common.CI.AzurePipelines; -using System.Threading; -using System.Text; - -[CheckBuildProjectConfigurations] -[UnsetVisualStudioEnvironmentVariables] -[MSBuildVerbosityMapping] -class AlphaVssBuild : NukeBuild -{ - public static int Main() => Execute(x => x.Compile); - - - [Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")] - readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release; - - [Parameter] - readonly string FeedUri; - - [Parameter] - readonly string NuGetApiKey = "VSTS"; - - [Solution] readonly Solution Solution; - [GitRepository] readonly GitRepository GitRepository; - [GitVersion] readonly GitVersion GitVersion; - - string RequiredMSBuildVersion = "[16.4,)"; - - AbsolutePath SourceDirectory => RootDirectory / "src"; - AbsolutePath ArtifactsDirectory => RootDirectory / "artifacts"; - AbsolutePath NuSpecDirectory => RootDirectory / "build" / "nuget"; - AbsolutePath DocFxFile => RootDirectory / "docs" / "docfx.json"; - AbsolutePath PackageArtifactsDirectory => ArtifactsDirectory / "package"; - AbsolutePath DocFxArtifactsDirectory => ArtifactsDirectory / "docs"; - AbsolutePath DocFxZipFilePath => ArtifactsDirectory / "docs.zip"; - - string MSBuildToolPath; - - protected override void OnBuildInitialized() - { - base.OnBuildInitialized(); - var result = - VSWhereTasks.VSWhere(s => s - .SetVersion(RequiredMSBuildVersion) - .EnableLatest() - .EnablePrerelease() - .EnableUTF8() - .SetLogOutput(Verbosity == Verbosity.Verbose) - .SetProperty("InstallationPath") - .SetFormat(VSWhereFormat.value) - ).Output.EnsureOnlyStd().FirstOrDefault().Text; - - var vsInstance = result.FirstOrDefault().NotNull($"Unable to find VS version {RequiredMSBuildVersion}"); - MSBuildToolPath = Path.Combine(result, "MSBuild\\Current\\Bin\\MSBuild.exe"); - Logger.Normal($"Using MSBuild at \"{MSBuildToolPath}\""); - MSBuildLogger = CustomMSBuildLogger; - NuGetLogger = CustomNuGetLogger; - if (IsServerBuild) - { - AzurePipelines.Instance.UpdateBuildNumber($"AlphaVSS-{GitVersion.SemVer}") - ; - } - } - - internal static void CustomMSBuildLogger(OutputType type, string output) - { - if (type == OutputType.Err || output.IndexOf(": error", StringComparison.Ordinal) != -1) - Logger.Error(output); - else if (output.IndexOf(": warning", StringComparison.Ordinal) != -1) - Logger.Warn(output); - else - Logger.Normal(output); - - } - - internal static void CustomNuGetLogger(OutputType type, string output) - { - if (type == OutputType.Err || output.StartsWith("ERROR:", StringComparison.OrdinalIgnoreCase)) - Logger.Error(output); - else if (output.StartsWith("WARNING:", StringComparison.OrdinalIgnoreCase)) - Logger.Warn(output); - else - Logger.Normal(output); - } - - Target Clean => _ => _ - .Before(Restore) - .Executes(() => - { - SourceDirectory.GlobDirectories("**/bin", "**/obj").ForEach(DeleteDirectory); - EnsureCleanDirectory(ArtifactsDirectory); - }); - - Target Restore => _ => _ - .Executes(() => - { - MSBuild(_ => _ - .SetToolPath(MSBuildToolPath) - .SetTargetPath(Solution) - .SetTargets("Restore")); - }); - - Target Compile => _ => _ - .DependsOn(Restore) - .Executes(() => - { - BuildProject("AlphaVSS.Common", Configuration, "AnyCPU"); - - BuildPlatformProject("core31"); - BuildPlatformProject("net45"); - - - void BuildPlatformProject(string projectConfigurationPrefix) - { - projectConfigurationPrefix = Configuration == Configuration.Debug ? $"{projectConfigurationPrefix}d" : projectConfigurationPrefix; - BuildProject("AlphaVSS.Platform", projectConfigurationPrefix, "Win32"); - BuildProject("AlphaVSS.Platform", projectConfigurationPrefix, "x64"); - } - - void BuildProject(string projectName, string configuration, string platform) - { - var project = Solution.AllProjects.FirstOrDefault(p => p.Name == projectName).NotNull($"Unable to find project named {projectName} in solution {Solution.Name}"); - - MSBuild(_ => _ - .SetToolPath(MSBuildToolPath) - .SetTargetPath(project) - .SetTargetPlatform((MSBuildTargetPlatform)platform) - .SetConfiguration(configuration) - .SetTargets("Build") - .SetAssemblyVersion(GitVersion.AssemblySemVer) - .SetFileVersion(GitVersion.AssemblySemFileVer) - .SetInformationalVersion(GitVersion.InformationalVersion) - .AddProperty("BuildProjectReferences", false) - .AddProperty("AlphaVss_VersionMajor", 1) - .SetInformationalVersion(GitVersion.InformationalVersion) - .SetMaxCpuCount(Environment.ProcessorCount) - .SetNodeReuse(IsLocalBuild)); - } - }); - - Target DocMetadata => _ => _ - .DependsOn(Compile) - .Executes(() => - { - DocFXTasks.DocFXMetadata(s => s - .SetProjects(DocFxFile) - .SetLogLevel(DocFXLogLevel.Verbose) - ); - }); - - Target DocBuild => _ => _ - .DependsOn(DocMetadata) - .Executes(() => - { - DocFXTasks.DocFXBuild(s => s - .SetConfigFile(DocFxFile) - .SetLogLevel(DocFXLogLevel.Verbose) - ); - }); - - Target DocPack => _ => _ - .DependsOn(DocBuild) - .Executes(() => - { - CompressionTasks.CompressZip(DocFxArtifactsDirectory, DocFxZipFilePath); - }); - - Target ServeDocs => _ => _ - .DependsOn(DocBuild) - .OnlyWhenStatic(() => IsLocalBuild) - .Executes(() => - { - DocFXTasks.DocFXServe(s => s - .SetFolder(ArtifactsDirectory / "docs") - ); - }); - - Target Build => _ => _ - .DependsOn(Clean, Compile); - - Target Pack => _ => _ - .DependsOn(Build) - .Executes(() => - { - var version = GitVersion.NuGetVersion; - if (IsLocalBuild) - version += DateTime.UtcNow.ToString("yyMMddHHmmss"); - - foreach (var nuspec in GlobFiles(NuSpecDirectory, "*.nuspec")) - { - NuGetPack(s => s - .SetMSBuildPath(MSBuildToolPath) - .SetOutputDirectory(ArtifactsDirectory) - .AddProperty("branch", GitVersion.BranchName) - .AddProperty("commit", GitVersion.Sha) - .SetVersion(version) - .SetTargetPath(nuspec) - ); - } - }); - - Target Push => _ => _ - .DependsOn(Pack) - .Requires(() => FeedUri) - .Executes(() => - { - foreach (var file in GlobFiles(ArtifactsDirectory, "*.nupkg")) - { - NuGetPush(s => s - .SetApiKey(NuGetApiKey) - .SetSource(FeedUri) - .SetTargetPath(file)); - } - }); - - Target UploadArtifacts => _ => _ - .DependsOn(Clean, Pack, DocPack) - .OnlyWhenStatic(() => IsServerBuild) - .Executes(() => - { - foreach (var file in GlobFiles(ArtifactsDirectory, "*.nupkg")) - { - UploadAzureArtifact("Package", "Package", file); - } - //UploadAzureArtifact("Package", "Package", null); - - Thread.Sleep(2000); - AzurePipelines.Instance.UploadArtifacts("docs", "docs", DocFxZipFilePath); - }); - - private void UploadAzureArtifact(string containerFolder, string artifactName, string fileName) - { - // ##vso[artifact.upload containerfolder=testresult;artifactname=uploadedresult;]c:\testresult.trx - StringBuilder command = new StringBuilder("##vso[artifact.upload containerfolder="); - command.Append(containerFolder); - command.Append(';'); - if (!String.IsNullOrEmpty(artifactName)) - { - command.Append("artifactname="); - command.Append(artifactName); - command.Append(';'); - } - - command.Append("]"); - if (!String.IsNullOrEmpty(fileName)) - command.Append(fileName); - - Console.WriteLine(command.ToString()); - } - - Target DistBuild => _ => _ - .DependsOn(Pack, UploadArtifacts); -} diff --git a/build/Properties/launchSettings.json b/build/Properties/launchSettings.json deleted file mode 100644 index f084b7b4..00000000 --- a/build/Properties/launchSettings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "profiles": { - "_build": { - "commandName": "Project", - "commandLineArgs": "--target compile" - } - } -} \ No newline at end of file diff --git a/build/VSWhereResult2.cs b/build/VSWhereResult2.cs deleted file mode 100644 index 74a03f20..00000000 --- a/build/VSWhereResult2.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Newtonsoft.Json; -using Nuke.Common.Tooling; -using Nuke.Common.Tools.VSWhere; -using Nuke.Common.Utilities.Collections; -[Serializable] -public partial class VSWhereResult2 : ISettingsEntity -{ - [JsonProperty] - public virtual string InstanceId { get; internal set; } - [JsonProperty] - public virtual DateTime InstallDate { get; internal set; } - [JsonProperty] - public virtual string InstallationName { get; internal set; } - [JsonProperty] - public virtual string InstallationPath { get; internal set; } - [JsonProperty] - public virtual string InstallationVersion { get; internal set; } - [JsonProperty] - public virtual string ProductId { get; internal set; } - [JsonProperty] - public virtual string ProductPath { get; internal set; } - [JsonProperty] - public virtual bool? IsPreRelease { get; internal set; } - [JsonProperty] - public virtual string DisplayName { get; internal set; } - [JsonProperty] - public virtual string Description { get; internal set; } - [JsonProperty] - public virtual string ChannelId { get; internal set; } - [JsonProperty] - public virtual string ChannelUri { get; internal set; } - [JsonProperty] - public virtual string EnginePath { get; internal set; } - [JsonProperty] - public virtual string ReleaseNotes { get; internal set; } - [JsonProperty] - public virtual string ThirdPartyNotices { get; internal set; } - [JsonProperty] - public virtual DateTime UpdateDate { get; internal set; } - [JsonProperty] - public virtual VSWhereCatalog Catalog { get; internal set; } - [JsonProperty] - public virtual IReadOnlyDictionary Properties => PropertiesInternal.AsReadOnly(); - [JsonProperty] - internal Dictionary PropertiesInternal { get; set; } = new Dictionary(StringComparer.OrdinalIgnoreCase); -} diff --git a/build/_build.csproj b/build/_build.csproj deleted file mode 100644 index cbfe94c5..00000000 --- a/build/_build.csproj +++ /dev/null @@ -1,53 +0,0 @@ - - - - Exe - netcoreapp3.1 - false - - False - CS0649;CS0169 - false - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/_build.csproj.DotSettings b/build/_build.csproj.DotSettings deleted file mode 100644 index b63e7569..00000000 --- a/build/_build.csproj.DotSettings +++ /dev/null @@ -1,24 +0,0 @@ - - DO_NOT_SHOW - DO_NOT_SHOW - Implicit - Implicit - ExpressionBody - 0 - NEXT_LINE - True - False - 120 - IF_OWNER_IS_SINGLE_LINE - WRAP_IF_LONG - False - <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> - <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> - True - True - True - True - True - True - True - True diff --git a/build/nuget/AlphaVSS.Native.NetCore.nuspec b/build/nuget/AlphaVSS.Native.NetCore.nuspec index 38c3c596..7954582d 100644 --- a/build/nuget/AlphaVSS.Native.NetCore.nuspec +++ b/build/nuget/AlphaVSS.Native.NetCore.nuspec @@ -16,15 +16,17 @@ Do not install this package manually, it will be added as a prerequisite by the Win32, VSS - + - - - - - - + + + + + + + + diff --git a/build/nuget/AlphaVSS.Native.NetFx.nuspec b/build/nuget/AlphaVSS.Native.NetFx.nuspec index 01ad3438..23818be4 100644 --- a/build/nuget/AlphaVSS.Native.NetFx.nuspec +++ b/build/nuget/AlphaVSS.Native.NetFx.nuspec @@ -14,14 +14,14 @@ Do not install this package manually, it will be added as a prerequisite by the Win32, VSS - + - - - - - + + + + + diff --git a/build/nuget/AlphaVSS.nuspec b/build/nuget/AlphaVSS.nuspec index d72bfd4a..60e4ffc5 100644 --- a/build/nuget/AlphaVSS.nuspec +++ b/build/nuget/AlphaVSS.nuspec @@ -9,29 +9,21 @@ https://alphavss.alphaleonis.com/ true AlphaVSS is a .NET class library providing a managed API for the Windows Volume Shadow Copy Service also known as VSS. - - Added support for .NET Core 3.1. -- Added TPL style async methods for asynchronous methods on IVssBackupComponents. + - Added support for .NET 8.0 + - Added support Copyright © Peter Palotas Win32, VSS - - - - + - - - - - - - - - + + + + diff --git a/global.json b/global.json deleted file mode 100644 index f529ebf1..00000000 --- a/global.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "sdk": { - "version": "3.1.100", - "rollForward": "LatestFeature" - } -} diff --git a/src/AlphaVSS.Common/AlphaVSS.Common.csproj b/src/AlphaVSS.Common/AlphaVSS.Common.csproj index 4ad0e8fd..fc7fe47f 100644 --- a/src/AlphaVSS.Common/AlphaVSS.Common.csproj +++ b/src/AlphaVSS.Common/AlphaVSS.Common.csproj @@ -1,8 +1,10 @@  - net45;netcoreapp3.1 + net8.0 false + Debug;Release + AnyCPU @@ -18,9 +20,10 @@ en-US true ..\..\artifacts - Alphaleonis.Win32.Vss + all + Alphaleonis.Win32.Vss diff --git a/src/AlphaVSS.Common/Classes/VssFactoryProvider.cs b/src/AlphaVSS.Common/Classes/VssFactoryProvider.cs index be2438af..f93c8be4 100644 --- a/src/AlphaVSS.Common/Classes/VssFactoryProvider.cs +++ b/src/AlphaVSS.Common/Classes/VssFactoryProvider.cs @@ -6,6 +6,7 @@ using System.Threading; using System.Diagnostics; using System.Linq; +using System.Runtime.InteropServices; #if NETCOREAPP using System.Runtime.Loader; #endif @@ -25,7 +26,7 @@ public class VssFactoryProvider : IVssFactoryProvider private readonly IVssAssemblyResolver m_resolver; private readonly Lazy m_assembly; - private static string PlatformSpecificAssemblyShortName => $"AlphaVSS.{(Environment.Is64BitOperatingSystem ? "x64" : "x86")}"; + private static string PlatformSpecificAssemblyShortName => $"AlphaVSS.{(RuntimeInformation.ProcessArchitecture switch { Architecture.X64 => "x64", Architecture.X86 => "x86", Architecture.Arm => "arm32", Architecture.Arm64 => "arm64", _ => throw new PlatformNotSupportedException() })}"; private static AssemblyName PlatformSpecificAssemblyName => new AssemblyName($"{PlatformSpecificAssemblyShortName}, Version={Assembly.GetExecutingAssembly().GetName().Version}, Culture=neutral, PublicKeyToken=959d3993561034e3"); /// diff --git a/src/AlphaVSS.Common/Resources/LocalizedStrings.Designer.cs b/src/AlphaVSS.Common/Resources/LocalizedStrings.Designer.cs index 24a4340a..4a96e7e4 100644 --- a/src/AlphaVSS.Common/Resources/LocalizedStrings.Designer.cs +++ b/src/AlphaVSS.Common/Resources/LocalizedStrings.Designer.cs @@ -19,7 +19,7 @@ namespace Alphaleonis.Win32.Vss.Resources { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "18.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class LocalizedStrings { diff --git a/src/AlphaVSS.Platform/AlphaVSS.Platform - Copy.vcxproj b/src/AlphaVSS.Platform/AlphaVSS.Platform - Copy.vcxproj deleted file mode 100644 index d9bbf691..00000000 --- a/src/AlphaVSS.Platform/AlphaVSS.Platform - Copy.vcxproj +++ /dev/null @@ -1,232 +0,0 @@ - - - - - net45d - Win32 - - - net45 - Win32 - - - net45d - x64 - - - net45 - x64 - - - net45d - Win32 - - - net45 - Win32 - - - net45d - x64 - - - net45 - x64 - - - - 16.0 - {3A977469-6361-469C-B180-5180CD9A15B4} - NetCoreCProj - AlphaVSSPlatform2 - 10.0 - AlphaVSS.Platform - - - - - netcoreapp3.1 - true - v142 - NetCore - DynamicLibrary - Unicode - - - 4.5 - false - v142 - true - DynamicLibrary - Unicode - - - netcoreapp3.1 - DynamicLibrary - true - v142 - NetCore - Unicode - - - netcoreapp3.1 - DynamicLibrary - false - v142 - NetCore - Unicode - - - 4.5 - true - v142 - true - DynamicLibrary - Unicode - - - 4.5 - false - v142 - true - DynamicLibrary - Unicode - - - 4.5 - true - v142 - true - DynamicLibrary - Unicode - - - 4.5 - false - v142 - true - DynamicLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - Use - pch.h - Level3 - WIN32;NDEBUG;%(PreprocessorDefinitions) - - - - - - Use - pch.h - Level3 - WIN32;_DEBUG;%(PreprocessorDefinitions) - - - - - - Use - pch.h - Level3 - _DEBUG;%(PreprocessorDefinitions) - - - - - - - - Use - pch.h - Level3 - NDEBUG;%(PreprocessorDefinitions) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create - Create - Create - Create - - - - - - - - - - - - - - - - - - - - - {2fb97b30-1050-4f6b-b729-b94aaa178ee4} - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/AlphaVSS.Platform/AlphaVSS.Platform.props b/src/AlphaVSS.Platform/AlphaVSS.Platform.props index fada8ef2..0282c274 100644 --- a/src/AlphaVSS.Platform/AlphaVSS.Platform.props +++ b/src/AlphaVSS.Platform/AlphaVSS.Platform.props @@ -6,11 +6,11 @@ x86 x64 + arm64 ALPHAVSS_VERSION_MAJOR=$(AlphaVss_VersionMajor);ALPHAVSS_VERSION_MINOR=$(AlphaVss_VersionMinor);ALPHAVSS_VERSION_PATCH=$(AlphaVss_VersionPatch);ALPHAVSS_COPYRIGHT=$(AlphaVss_Copyright);ALPHAVSS_DESCRIPTION=$(AlphaVss_Description);ALPHAVSS_ASSEMBLYVERSION=$(AssemblyVersion);ALPHAVSS_FILEVERSION=$(FileVersion);ALPHAVSS_INFORMATIONALVERSION=$(InformationalVersion) - netcoreapp3.1 - net45 + net8.0 diff --git a/src/AlphaVSS.Platform/AlphaVSS.Platform.vcxproj b/src/AlphaVSS.Platform/AlphaVSS.Platform.vcxproj index 7ea8940c..be88c395 100644 --- a/src/AlphaVSS.Platform/AlphaVSS.Platform.vcxproj +++ b/src/AlphaVSS.Platform/AlphaVSS.Platform.vcxproj @@ -1,36 +1,28 @@ - - core31d - Win32 - - - core31d - x64 + + net8d + ARM64 - - core31 + + net8d Win32 - - core31 + + net8d x64 - - net45d - Win32 + + net8 + ARM64 - - net45 + + net8 Win32 - - net45d - x64 - - - net45 + + net8 x64 @@ -41,71 +33,56 @@ AlphaVSSPlatform2 10.0 AlphaVSS.Platform + 7.0 - - v4.5 - true - true - v142 - DynamicLibrary - Unicode - - - netcoreapp3.1 + + net8.0 true - v142 + v145 NetCore DynamicLibrary Unicode - - v4.5 - true - false - v142 - DynamicLibrary - Unicode - - - netcoreapp3.1 + + net8.0 NetCore false - v142 + v145 DynamicLibrary Unicode - - v4.5 - true + + net8.0 DynamicLibrary true - v142 + v145 + NetCore Unicode - - netcoreapp3.1 - DynamicLibrary + + net8.0 true - v142 + v145 NetCore + DynamicLibrary Unicode - - v4.5 - true + + net8.0 + NetCore DynamicLibrary false - v142 + v145 Unicode - - netcoreapp3.1 + + net8.0 + true + v145 NetCore DynamicLibrary - false - v142 Unicode @@ -113,42 +90,27 @@ - + - + - + - + - + - - - - - - - + - - - Use - pch.h - Level3 - WIN32;NDEBUG;%(PreprocessorDefinitions) - - - - + Use pch.h @@ -157,16 +119,7 @@ - - - Use - pch.h - Level3 - WIN32;_DEBUG;%(PreprocessorDefinitions) - - - - + Use pch.h @@ -175,7 +128,7 @@ - + Use pch.h @@ -184,7 +137,7 @@ - + Use pch.h @@ -193,7 +146,7 @@ - + Use pch.h @@ -202,12 +155,14 @@ - + Use pch.h Level3 NDEBUG;%(PreprocessorDefinitions) + Default + Default @@ -237,14 +192,12 @@ - Create - Create - Create - Create - Create - Create - Create - Create + Create + Create + Create + Create + Create + Create diff --git a/src/AlphaVSS.Platform/VssBackupComponents.cpp b/src/AlphaVSS.Platform/VssBackupComponents.cpp index 78a9a18c..052e60bc 100644 --- a/src/AlphaVSS.Platform/VssBackupComponents.cpp +++ b/src/AlphaVSS.Platform/VssBackupComponents.cpp @@ -123,7 +123,6 @@ namespace Alphaleonis { return ToGuid(idSnapshot); } - [SecurityPermissionAttribute(SecurityAction::LinkDemand)] void VssBackupComponents::BackupComplete() { ::IVssAsync* pAsync; diff --git a/src/AlphaVSS.Platform/VssExamineWriterMetadata.h b/src/AlphaVSS.Platform/VssExamineWriterMetadata.h index 8f6957a0..7099c96a 100644 --- a/src/AlphaVSS.Platform/VssExamineWriterMetadata.h +++ b/src/AlphaVSS.Platform/VssExamineWriterMetadata.h @@ -42,7 +42,6 @@ namespace Alphaleonis { namespace Win32 { namespace Vss property System::Version^ Version { virtual System::Version^ get(); } property IList^ ExcludeFromSnapshotFiles { virtual IList^ get(); } internal: - [SecurityPermission(SecurityAction::LinkDemand)] static IVssExamineWriterMetadata^ Adopt(::IVssExamineWriterMetadata *ewm); private: VssExamineWriterMetadata(::IVssExamineWriterMetadata *examineWriterMetadata); @@ -67,4 +66,4 @@ namespace Alphaleonis { namespace Win32 { namespace Vss System::Version^ m_version; }; } -} } \ No newline at end of file +} } From 7b9f8192072b6b383648690ee8b387d1a8734db0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Roux?= <42benoit.roux@gmail.com> Date: Wed, 25 Mar 2026 11:40:25 +0100 Subject: [PATCH 2/2] Reintroduce Nuke for build --- .nuke/build.schema.json | 132 +++++++++++ .nuke/parameters.json | 4 + AlphaVSS.sln | 8 + build.cmd | 7 + build.ps1 | 74 ++++++ build.sh | 67 ++++++ build/.editorconfig | 1 + build/.gitignore | 9 + build/Build.cs | 219 ++++++++++++++++++ build/Configuration.cs | 16 ++ build/Directory.Build.props | 8 + build/Directory.Build.targets | 8 + build/Properties/launchSettings.json | 11 + build/_build.csproj | 37 +++ build/_build.csproj.DotSettings | 31 +++ build/api/.gitignore | 5 + build/api/index.md | 2 + build/articles/intro.md | 1 + build/articles/toc.yml | 2 + src/AlphaVSS.Common/AlphaVSS.Common.csproj | 10 +- .../Properties/launchSettings.json | 7 + 21 files changed, 650 insertions(+), 9 deletions(-) create mode 100644 .nuke/build.schema.json create mode 100644 .nuke/parameters.json create mode 100755 build.cmd create mode 100644 build.ps1 create mode 100755 build.sh create mode 100644 build/.gitignore create mode 100644 build/Build.cs create mode 100644 build/Configuration.cs create mode 100644 build/Directory.Build.props create mode 100644 build/Directory.Build.targets create mode 100644 build/Properties/launchSettings.json create mode 100644 build/_build.csproj create mode 100644 build/_build.csproj.DotSettings create mode 100644 build/api/.gitignore create mode 100644 build/api/index.md create mode 100644 build/articles/intro.md create mode 100644 build/articles/toc.yml create mode 100644 src/AlphaVSS.Common/Properties/launchSettings.json diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json new file mode 100644 index 00000000..b6892141 --- /dev/null +++ b/.nuke/build.schema.json @@ -0,0 +1,132 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "definitions": { + "Host": { + "type": "string", + "enum": [ + "AppVeyor", + "AzurePipelines", + "Bamboo", + "Bitbucket", + "Bitrise", + "GitHubActions", + "GitLab", + "Jenkins", + "Rider", + "SpaceAutomation", + "TeamCity", + "Terminal", + "TravisCI", + "VisualStudio", + "VSCode" + ] + }, + "ExecutableTarget": { + "type": "string", + "enum": [ + "Build", + "Clean", + "Compile", + "DistBuild", + "Pack", + "Push", + "Restore", + "UploadArtifacts" + ] + }, + "Verbosity": { + "type": "string", + "description": "", + "enum": [ + "Verbose", + "Normal", + "Minimal", + "Quiet" + ] + }, + "NukeBuild": { + "properties": { + "Continue": { + "type": "boolean", + "description": "Indicates to continue a previously failed build attempt" + }, + "Help": { + "type": "boolean", + "description": "Shows the help text for this build assembly" + }, + "Host": { + "description": "Host for execution. Default is 'automatic'", + "$ref": "#/definitions/Host" + }, + "NoLogo": { + "type": "boolean", + "description": "Disables displaying the NUKE logo" + }, + "Partition": { + "type": "string", + "description": "Partition to use on CI" + }, + "Plan": { + "type": "boolean", + "description": "Shows the execution plan (HTML)" + }, + "Profile": { + "type": "array", + "description": "Defines the profiles to load", + "items": { + "type": "string" + } + }, + "Root": { + "type": "string", + "description": "Root directory during build execution" + }, + "Skip": { + "type": "array", + "description": "List of targets to be skipped. Empty list skips all dependencies", + "items": { + "$ref": "#/definitions/ExecutableTarget" + } + }, + "Target": { + "type": "array", + "description": "List of targets to be invoked. Default is '{default_target}'", + "items": { + "$ref": "#/definitions/ExecutableTarget" + } + }, + "Verbosity": { + "description": "Logging verbosity during build execution. Default is 'Normal'", + "$ref": "#/definitions/Verbosity" + } + } + } + }, + "allOf": [ + { + "properties": { + "Configuration": { + "type": "string", + "description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)", + "enum": [ + "Debug", + "Release" + ] + }, + "FeedUri": { + "type": "string" + }, + "NuGetApiKey": { + "type": "string" + }, + "Solution": { + "type": "string", + "description": "Path to a solution file that is automatically loaded" + } + } + }, + { + "$ref": "#/definitions/NukeBuild" + } + ] +} diff --git a/.nuke/parameters.json b/.nuke/parameters.json new file mode 100644 index 00000000..f8d2b958 --- /dev/null +++ b/.nuke/parameters.json @@ -0,0 +1,4 @@ +{ + "$schema": "build.schema.json", + "Solution": "AlphaVSS.sln" +} diff --git a/AlphaVSS.sln b/AlphaVSS.sln index 53cbe068..b198c026 100644 --- a/AlphaVSS.sln +++ b/AlphaVSS.sln @@ -24,6 +24,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AlphaVSS.Platform", "src\Al {2276E222-6841-4DA9-B5C9-549E9ADB33BE} = {2276E222-6841-4DA9-B5C9-549E9ADB33BE} EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_build", "build\_build.csproj", "{4056BD12-5FA8-4D2E-274A-7E85E858A5FC}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution NET8|ARM64 = NET8|ARM64 @@ -58,6 +60,12 @@ Global {3A977469-6361-469C-B180-5180CD9A15B4}.net8d|x64.Build.0 = net8d|x64 {3A977469-6361-469C-B180-5180CD9A15B4}.net8d|x86.ActiveCfg = net8d|Win32 {3A977469-6361-469C-B180-5180CD9A15B4}.net8d|x86.Build.0 = net8d|Win32 + {4056BD12-5FA8-4D2E-274A-7E85E858A5FC}.NET8|ARM64.ActiveCfg = net8d|Any CPU + {4056BD12-5FA8-4D2E-274A-7E85E858A5FC}.NET8|x64.ActiveCfg = net8d|Any CPU + {4056BD12-5FA8-4D2E-274A-7E85E858A5FC}.NET8|x86.ActiveCfg = net8d|Any CPU + {4056BD12-5FA8-4D2E-274A-7E85E858A5FC}.net8d|ARM64.ActiveCfg = Release|Any CPU + {4056BD12-5FA8-4D2E-274A-7E85E858A5FC}.net8d|x64.ActiveCfg = net8d|Any CPU + {4056BD12-5FA8-4D2E-274A-7E85E858A5FC}.net8d|x86.ActiveCfg = net8d|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/build.cmd b/build.cmd new file mode 100755 index 00000000..b08cc590 --- /dev/null +++ b/build.cmd @@ -0,0 +1,7 @@ +:; set -eo pipefail +:; SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd) +:; ${SCRIPT_DIR}/build.sh "$@" +:; exit $? + +@ECHO OFF +powershell -ExecutionPolicy ByPass -NoProfile -File "%~dp0build.ps1" %* diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 00000000..4634dc03 --- /dev/null +++ b/build.ps1 @@ -0,0 +1,74 @@ +[CmdletBinding()] +Param( + [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)] + [string[]]$BuildArguments +) + +Write-Output "PowerShell $($PSVersionTable.PSEdition) version $($PSVersionTable.PSVersion)" + +Set-StrictMode -Version 2.0; $ErrorActionPreference = "Stop"; $ConfirmPreference = "None"; trap { Write-Error $_ -ErrorAction Continue; exit 1 } +$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent + +########################################################################### +# CONFIGURATION +########################################################################### + +$BuildProjectFile = "$PSScriptRoot\build\_build.csproj" +$TempDirectory = "$PSScriptRoot\\.nuke\temp" + +$DotNetGlobalFile = "$PSScriptRoot\\global.json" +$DotNetInstallUrl = "https://dot.net/v1/dotnet-install.ps1" +$DotNetChannel = "STS" + +$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1 +$env:DOTNET_NOLOGO = 1 + +########################################################################### +# EXECUTION +########################################################################### + +function ExecSafe([scriptblock] $cmd) { + & $cmd + if ($LASTEXITCODE) { exit $LASTEXITCODE } +} + +# If dotnet CLI is installed globally and it matches requested version, use for execution +if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue) -and ` + $(dotnet --version) -and $LASTEXITCODE -eq 0) { + $env:DOTNET_EXE = (Get-Command "dotnet").Path +} +else { + # Download install script + $DotNetInstallFile = "$TempDirectory\dotnet-install.ps1" + New-Item -ItemType Directory -Path $TempDirectory -Force | Out-Null + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 + (New-Object System.Net.WebClient).DownloadFile($DotNetInstallUrl, $DotNetInstallFile) + + # If global.json exists, load expected version + if (Test-Path $DotNetGlobalFile) { + $DotNetGlobal = $(Get-Content $DotNetGlobalFile | Out-String | ConvertFrom-Json) + if ($DotNetGlobal.PSObject.Properties["sdk"] -and $DotNetGlobal.sdk.PSObject.Properties["version"]) { + $DotNetVersion = $DotNetGlobal.sdk.version + } + } + + # Install by channel or version + $DotNetDirectory = "$TempDirectory\dotnet-win" + if (!(Test-Path variable:DotNetVersion)) { + ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Channel $DotNetChannel -NoPath } + } else { + ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath } + } + $env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe" + $env:PATH = "$DotNetDirectory;$env:PATH" +} + +Write-Output "Microsoft (R) .NET SDK version $(& $env:DOTNET_EXE --version)" + +if (Test-Path env:NUKE_ENTERPRISE_TOKEN) { + & $env:DOTNET_EXE nuget remove source "nuke-enterprise" > $null + & $env:DOTNET_EXE nuget add source "https://f.feedz.io/nuke/enterprise/nuget" --name "nuke-enterprise" --username "PAT" --password $env:NUKE_ENTERPRISE_TOKEN > $null +} + +ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet } +ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile --no-build -- $BuildArguments } diff --git a/build.sh b/build.sh new file mode 100755 index 00000000..fdff0c62 --- /dev/null +++ b/build.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash + +bash --version 2>&1 | head -n 1 + +set -eo pipefail +SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd) + +########################################################################### +# CONFIGURATION +########################################################################### + +BUILD_PROJECT_FILE="$SCRIPT_DIR/build/_build.csproj" +TEMP_DIRECTORY="$SCRIPT_DIR//.nuke/temp" + +DOTNET_GLOBAL_FILE="$SCRIPT_DIR//global.json" +DOTNET_INSTALL_URL="https://dot.net/v1/dotnet-install.sh" +DOTNET_CHANNEL="STS" + +export DOTNET_CLI_TELEMETRY_OPTOUT=1 +export DOTNET_NOLOGO=1 + +########################################################################### +# EXECUTION +########################################################################### + +function FirstJsonValue { + perl -nle 'print $1 if m{"'"$1"'": "([^"]+)",?}' <<< "${@:2}" +} + +# If dotnet CLI is installed globally and it matches requested version, use for execution +if [ -x "$(command -v dotnet)" ] && dotnet --version &>/dev/null; then + export DOTNET_EXE="$(command -v dotnet)" +else + # Download install script + DOTNET_INSTALL_FILE="$TEMP_DIRECTORY/dotnet-install.sh" + mkdir -p "$TEMP_DIRECTORY" + curl -Lsfo "$DOTNET_INSTALL_FILE" "$DOTNET_INSTALL_URL" + chmod +x "$DOTNET_INSTALL_FILE" + + # If global.json exists, load expected version + if [[ -f "$DOTNET_GLOBAL_FILE" ]]; then + DOTNET_VERSION=$(FirstJsonValue "version" "$(cat "$DOTNET_GLOBAL_FILE")") + if [[ "$DOTNET_VERSION" == "" ]]; then + unset DOTNET_VERSION + fi + fi + + # Install by channel or version + DOTNET_DIRECTORY="$TEMP_DIRECTORY/dotnet-unix" + if [[ -z ${DOTNET_VERSION+x} ]]; then + "$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --channel "$DOTNET_CHANNEL" --no-path + else + "$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --version "$DOTNET_VERSION" --no-path + fi + export DOTNET_EXE="$DOTNET_DIRECTORY/dotnet" + export PATH="$DOTNET_DIRECTORY:$PATH" +fi + +echo "Microsoft (R) .NET SDK version $("$DOTNET_EXE" --version)" + +if [[ ! -z ${NUKE_ENTERPRISE_TOKEN+x} && "$NUKE_ENTERPRISE_TOKEN" != "" ]]; then + "$DOTNET_EXE" nuget remove source "nuke-enterprise" &>/dev/null || true + "$DOTNET_EXE" nuget add source "https://f.feedz.io/nuke/enterprise/nuget" --name "nuke-enterprise" --username "PAT" --password "$NUKE_ENTERPRISE_TOKEN" --store-password-in-clear-text &>/dev/null || true +fi + +"$DOTNET_EXE" build "$BUILD_PROJECT_FILE" /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet +"$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" --no-build -- "$@" diff --git a/build/.editorconfig b/build/.editorconfig index 94be682c..31e43dcd 100644 --- a/build/.editorconfig +++ b/build/.editorconfig @@ -5,6 +5,7 @@ dotnet_style_qualification_for_method = false:warning dotnet_style_qualification_for_event = false:warning dotnet_style_require_accessibility_modifiers = never:warning +csharp_style_expression_bodied_methods = true:silent csharp_style_expression_bodied_properties = true:warning csharp_style_expression_bodied_indexers = true:warning csharp_style_expression_bodied_accessors = true:warning diff --git a/build/.gitignore b/build/.gitignore new file mode 100644 index 00000000..4378419e --- /dev/null +++ b/build/.gitignore @@ -0,0 +1,9 @@ +############### +# folder # +############### +/**/DROP/ +/**/TEMP/ +/**/packages/ +/**/bin/ +/**/obj/ +_site diff --git a/build/Build.cs b/build/Build.cs new file mode 100644 index 00000000..ea151918 --- /dev/null +++ b/build/Build.cs @@ -0,0 +1,219 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Newtonsoft.Json; +using Nuke.Common; +using Nuke.Common.Execution; +using Nuke.Common.Git; +using Nuke.Common.IO; +using Nuke.Common.ProjectModel; +using Nuke.Common.Tooling; +using Nuke.Common.Tools.DotNet; +using Nuke.Common.Tools.GitVersion; +using Nuke.Common.Tools.MSBuild; +using Nuke.Common.Tools.VSWhere; +using Nuke.Common.Tools.NuGet; +using Nuke.Common.Utilities; +using Nuke.Common.Utilities.Collections; +using static Nuke.Common.EnvironmentInfo; +using static Nuke.Common.Tools.NuGet.NuGetTasks; +using static Nuke.Common.IO.PathConstruction; +using static Nuke.Common.Tools.MSBuild.MSBuildTasks; +using Nuke.Common.CI.AzurePipelines; +using System.Threading; +using System.Text; + +using Nuke.Common.Tools.DocFX; + +using Serilog.Core; + +using static Nuke.Common.EnvironmentInfo; +using static Nuke.Common.IO.PathConstruction; + +[UnsetVisualStudioEnvironmentVariables] +[MSBuildVerbosityMapping] +class AlphaVssBuild : NukeBuild +{ + public static int Main() => Execute(x => x.Compile); + + + [Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")] + readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release; + + [Parameter] + readonly string FeedUri; + + [Parameter] + readonly string NuGetApiKey = "VSTS"; + + [Solution] readonly Solution Solution; + [GitRepository] readonly GitRepository GitRepository; + [GitVersion] readonly GitVersion GitVersion; + + string RequiredMSBuildVersion = "[18.4.0,)"; + + AbsolutePath SourceDirectory => RootDirectory / "src"; + AbsolutePath ArtifactsDirectory => RootDirectory / "artifacts"; + AbsolutePath NuSpecDirectory => RootDirectory / "build" / "nuget"; + AbsolutePath PackageArtifactsDirectory => ArtifactsDirectory / "package"; + + string MSBuildToolPath; + + protected override void OnBuildInitialized() + { + base.OnBuildInitialized(); + var result = + VSWhereTasks.VSWhere(s => s + .SetVersion(RequiredMSBuildVersion) + .EnableLatest() + .EnablePrerelease() + .EnableUTF8() + .SetProperty("InstallationPath") + .SetFormat(VSWhereFormat.value) + ).Output.LastOrDefault().Text; + + MSBuildToolPath = Path.Combine(result, "MSBuild\\Current\\Bin\\MSBuild.exe"); + if (IsServerBuild) + { + AzurePipelines.Instance.UpdateBuildNumber($"AlphaVSS-{GitVersion.SemVer}") + ; + } + } + + Target Clean => _ => _ + .Before(Restore) + .Executes(() => + { + SourceDirectory.GlobDirectories("**\\bin", "**\\obj").ForEach(f => f.DeleteDirectory()); + ArtifactsDirectory.CreateOrCleanDirectory(); + }); + + Target Restore => _ => _ + .Executes(() => + { + MSBuild(_ => _ + .SetProcessToolPath(MSBuildToolPath) + .SetTargetPath(Solution.Projects.FirstOrDefault(p => p.Name == "AlphaVSS.Common")) + .SetTargets("Restore")); + MSBuild(_ => _ + .SetProcessToolPath(MSBuildToolPath) + .SetTargetPath(Solution.Projects.FirstOrDefault(p => p.Name == "AlphaVSS.Platform")) + .SetTargets("Restore")); + }); + + Target Compile => _ => _ + .DependsOn(Restore) + .Executes(() => + { + BuildProject("AlphaVSS.Common", Configuration == Configuration.Debug ? "net8d" : "net8", "AnyCPU"); + + BuildPlatformProject("net8"); + + + void BuildPlatformProject(string projectConfigurationPrefix) + { + projectConfigurationPrefix = Configuration == Configuration.Debug ? $"{projectConfigurationPrefix}d" : projectConfigurationPrefix; + BuildProject("AlphaVSS.Platform", projectConfigurationPrefix, "Win32"); + BuildProject("AlphaVSS.Platform", projectConfigurationPrefix, "x64"); + BuildProject("AlphaVSS.Platform", projectConfigurationPrefix, "arm64"); + } + + void BuildProject(string projectName, string configuration, string platform) + { + var project = Solution.AllProjects.FirstOrDefault(p => p.Name == projectName).NotNull($"Unable to find project named {projectName} in solution {Solution.Name}"); + + MSBuild(s => s + .SetProcessToolPath(MSBuildToolPath) + .SetTargetPath(project) + .SetTargetPlatform((MSBuildTargetPlatform)platform) + .SetConfiguration(configuration) + .SetTargets("Build") + .SetAssemblyVersion(GitVersion.AssemblySemVer) + .SetFileVersion(GitVersion.AssemblySemFileVer) + .SetInformationalVersion(GitVersion.InformationalVersion) + .AddProperty("BuildProjectReferences", true) + .AddProperty("AlphaVss_VersionMajor", 1) + .SetInformationalVersion(GitVersion.InformationalVersion) + .SetMaxCpuCount(Environment.ProcessorCount) + .SetNodeReuse(IsLocalBuild)); + } + }); + + + Target Build => _ => _ + .DependsOn(Clean, Compile); + + Target Pack => _ => _ + .DependsOn(Build) + .Executes(() => + { + var version = GitVersion.NuGetVersion; + if (IsLocalBuild) + version += DateTime.UtcNow.ToString("yyMMddHHmmss"); + + foreach (var nuspec in NuSpecDirectory.GlobFiles("*.nuspec")) + { + NuGetPack(s => s + .SetMSBuildPath(MSBuildToolPath) + .SetOutputDirectory(ArtifactsDirectory) + .AddProperty("branch", GitVersion.BranchName) + .AddProperty("commit", GitVersion.Sha) + .SetVersion(version) + .SetTargetPath(nuspec) + ); + } + }); + + Target Push => _ => _ + .DependsOn(Pack) + .Requires(() => FeedUri) + .Executes(() => + { + foreach (var file in ArtifactsDirectory.GlobFiles("*.nupkg")) + { + NuGetPush(s => s + .SetApiKey(NuGetApiKey) + .SetSource(FeedUri) + .SetTargetPath(file)); + } + }); + + Target UploadArtifacts => _ => _ + .DependsOn(Clean, Pack) + .OnlyWhenStatic(() => IsServerBuild) + .Executes(() => + { + foreach (var file in ArtifactsDirectory.GlobFiles("*.nupkg")) + { + UploadAzureArtifact("Package", "Package", file); + } + //UploadAzureArtifact("Package", "Package", null); + + Thread.Sleep(2000); + }); + + private void UploadAzureArtifact(string containerFolder, string artifactName, string fileName) + { + // ##vso[artifact.upload containerfolder=testresult;artifactname=uploadedresult;]c:\testresult.trx + StringBuilder command = new StringBuilder("##vso[artifact.upload containerfolder="); + command.Append(containerFolder); + command.Append(';'); + if (!String.IsNullOrEmpty(artifactName)) + { + command.Append("artifactname="); + command.Append(artifactName); + command.Append(';'); + } + + command.Append("]"); + if (!String.IsNullOrEmpty(fileName)) + command.Append(fileName); + + Console.WriteLine(command.ToString()); + } + + Target DistBuild => _ => _ + .DependsOn(Pack, UploadArtifacts); + +} diff --git a/build/Configuration.cs b/build/Configuration.cs new file mode 100644 index 00000000..9c08b1ae --- /dev/null +++ b/build/Configuration.cs @@ -0,0 +1,16 @@ +using System; +using System.ComponentModel; +using System.Linq; +using Nuke.Common.Tooling; + +[TypeConverter(typeof(TypeConverter))] +public class Configuration : Enumeration +{ + public static Configuration Debug = new Configuration { Value = nameof(Debug) }; + public static Configuration Release = new Configuration { Value = nameof(Release) }; + + public static implicit operator string(Configuration configuration) + { + return configuration.Value; + } +} diff --git a/build/Directory.Build.props b/build/Directory.Build.props new file mode 100644 index 00000000..e147d635 --- /dev/null +++ b/build/Directory.Build.props @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/build/Directory.Build.targets b/build/Directory.Build.targets new file mode 100644 index 00000000..25326095 --- /dev/null +++ b/build/Directory.Build.targets @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/build/Properties/launchSettings.json b/build/Properties/launchSettings.json new file mode 100644 index 00000000..69bec07e --- /dev/null +++ b/build/Properties/launchSettings.json @@ -0,0 +1,11 @@ +{ + "profiles": { + "_build": { + "commandName": "Project" + }, + "WSL": { + "commandName": "WSL2", + "distributionName": "" + } + } +} \ No newline at end of file diff --git a/build/_build.csproj b/build/_build.csproj new file mode 100644 index 00000000..fca2765c --- /dev/null +++ b/build/_build.csproj @@ -0,0 +1,37 @@ + + + + Exe + net10.0 + + CS0649;CS0169;CA1050;CA1822;CA2211;IDE1006 + .. + .. + 1 + false + Release + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/build/_build.csproj.DotSettings b/build/_build.csproj.DotSettings new file mode 100644 index 00000000..88a8824c --- /dev/null +++ b/build/_build.csproj.DotSettings @@ -0,0 +1,31 @@ + + DO_NOT_SHOW + DO_NOT_SHOW + DO_NOT_SHOW + DO_NOT_SHOW + DO_NOT_SHOW + Implicit + Implicit + ExpressionBody + 0 + NEXT_LINE + True + False + 120 + IF_OWNER_IS_SINGLE_LINE + WRAP_IF_LONG + False + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy><Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"><ElementKinds><Kind Name="FIELD" /><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" WarnAboutPrefixesAndSuffixes="False" Prefix="" Suffix="" Style="AaBb" /></Policy> + <Policy><Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static fields (private)"><ElementKinds><Kind Name="FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" WarnAboutPrefixesAndSuffixes="False" Prefix="" Suffix="" Style="AaBb" /></Policy> + True + True + True + True + True + True + True + True + True + True diff --git a/build/api/.gitignore b/build/api/.gitignore new file mode 100644 index 00000000..e8079a3b --- /dev/null +++ b/build/api/.gitignore @@ -0,0 +1,5 @@ +############### +# temp file # +############### +*.yml +.manifest diff --git a/build/api/index.md b/build/api/index.md new file mode 100644 index 00000000..78dc9c00 --- /dev/null +++ b/build/api/index.md @@ -0,0 +1,2 @@ +# PLACEHOLDER +TODO: Add .NET projects to the *src* folder and run `docfx` to generate **REAL** *API Documentation*! diff --git a/build/articles/intro.md b/build/articles/intro.md new file mode 100644 index 00000000..c0478ced --- /dev/null +++ b/build/articles/intro.md @@ -0,0 +1 @@ +# Add your introductions here! diff --git a/build/articles/toc.yml b/build/articles/toc.yml new file mode 100644 index 00000000..ff89ef1f --- /dev/null +++ b/build/articles/toc.yml @@ -0,0 +1,2 @@ +- name: Introduction + href: intro.md diff --git a/src/AlphaVSS.Common/AlphaVSS.Common.csproj b/src/AlphaVSS.Common/AlphaVSS.Common.csproj index fc7fe47f..1ba2a7dc 100644 --- a/src/AlphaVSS.Common/AlphaVSS.Common.csproj +++ b/src/AlphaVSS.Common/AlphaVSS.Common.csproj @@ -1,10 +1,8 @@  - net8.0 + net8.0 false - Debug;Release - AnyCPU @@ -32,12 +30,6 @@ AlphaVSS.snk - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - True diff --git a/src/AlphaVSS.Common/Properties/launchSettings.json b/src/AlphaVSS.Common/Properties/launchSettings.json new file mode 100644 index 00000000..d7ee9549 --- /dev/null +++ b/src/AlphaVSS.Common/Properties/launchSettings.json @@ -0,0 +1,7 @@ +{ + "profiles": { + "AlphaVSS.Common": { + "commandName": "Project" + } + } +} \ No newline at end of file