diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6f794ee2d3..6aacc17d36 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,9 +28,9 @@ on: - '!**/*.md' jobs: - windows-2022: - name: windows-2022 - runs-on: windows-2022 + windows-latest: + name: windows-latest + runs-on: windows-latest steps: - name: 'Allow long file path' run: git config --system core.longpaths true @@ -40,27 +40,23 @@ jobs: run: | echo "Adding GNU tar to PATH" echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%" - - uses: actions/setup-dotnet@v3 - with: - dotnet-version: | - 2.1.* - 5.0.* - uses: actions/checkout@v3 - - name: Cache .nuke/temp, ~/.nuget/packages + - name: 'Cache: .nuke/temp, ~/.nuget/packages' uses: actions/cache@v3 with: path: | .nuke/temp ~/.nuget/packages key: ${{ runner.os }}-${{ hashFiles('global.json', 'src/**/*.csproj', 'src/**/package.json') }} - - name: Run './build.cmd InstallDependencies Compile Test Pack Publish' + - name: 'Run: InstallDependencies, Compile, Test, Pack, Publish' run: ./build.cmd InstallDependencies Compile Test Pack Publish env: NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} MYGET_API_KEY: ${{ secrets.MYGET_API_KEY }} CHOCO_API_KEY: ${{ secrets.CHOCO_API_KEY }} NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} - - uses: actions/upload-artifact@v3 + - name: 'Publish: artifacts' + uses: actions/upload-artifact@v3 with: name: artifacts path: artifacts diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 2bcd386bc5..d0263df1e9 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -26,9 +26,12 @@ on: - '!**/*.md' jobs: - windows-2022: - name: windows-2022 - runs-on: windows-2022 + windows-latest: + name: windows-latest + runs-on: windows-latest + concurrency: + group: ${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.run_id }} + cancel-in-progress: true steps: - name: 'Allow long file path' run: git config --system core.longpaths true @@ -38,18 +41,13 @@ jobs: run: | echo "Adding GNU tar to PATH" echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%" - - uses: actions/setup-dotnet@v3 - with: - dotnet-version: | - 2.1.* - 5.0.* - uses: actions/checkout@v3 - - name: Cache .nuke/temp, ~/.nuget/packages + - name: 'Cache: .nuke/temp, ~/.nuget/packages' uses: actions/cache@v3 with: path: | .nuke/temp ~/.nuget/packages key: ${{ runner.os }}-${{ hashFiles('global.json', 'src/**/*.csproj', 'src/**/package.json') }} - - name: Run './build.cmd InstallDependencies Compile Test Pack' + - name: 'Run: InstallDependencies, Compile, Test, Pack' run: ./build.cmd InstallDependencies Compile Test Pack diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index 41e2a32820..57501ad2b6 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -1,7 +1,7 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "title": "Build Schema", "$ref": "#/definitions/build", + "title": "Build Schema", "definitions": { "build": { "type": "object", @@ -131,4 +131,4 @@ } } } -} \ No newline at end of file +} diff --git a/build.ps1 b/build.ps1 index 8c52d631ce..c0c0e6123c 100644 --- a/build.ps1 +++ b/build.ps1 @@ -18,7 +18,7 @@ $TempDirectory = "$PSScriptRoot\\.nuke\temp" $DotNetGlobalFile = "$PSScriptRoot\\global.json" $DotNetInstallUrl = "https://dot.net/v1/dotnet-install.ps1" -$DotNetChannel = "Current" +$DotNetChannel = "STS" $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1 $env:DOTNET_CLI_TELEMETRY_OPTOUT = 1 @@ -65,5 +65,10 @@ else { 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 index 1f3ba09e20..2f10dcb543 100755 --- a/build.sh +++ b/build.sh @@ -14,7 +14,7 @@ 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="Current" +DOTNET_CHANNEL="STS" export DOTNET_CLI_TELEMETRY_OPTOUT=1 export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 @@ -58,5 +58,10 @@ 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/Build.CI.GitHubActions.cs b/build/Build.CI.GitHubActions.cs index 148ded77b6..c70ae23d14 100644 --- a/build/Build.CI.GitHubActions.cs +++ b/build/Build.CI.GitHubActions.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using System.Linq; using Nuke.Common.CI.GitHubActions; using Nuke.Common.CI.GitHubActions.Configuration; using Nuke.Common.Execution; @@ -7,7 +6,7 @@ [CustomGitHubActions( "pr", - GitHubActionsImage.WindowsServer2022, + GitHubActionsImage.WindowsLatest, // GitHubActionsImage.UbuntuLatest, // GitHubActionsImage.MacOsLatest, OnPullRequestBranches = new[] { "master", "main" }, @@ -15,11 +14,12 @@ OnPullRequestExcludePaths = new[] { "**/*.md" }, PublishArtifacts = false, InvokedTargets = new[] { nameof(InstallDependencies), nameof(Compile), nameof(Test), nameof(Pack) }, - CacheKeyFiles = new[] { "global.json", "src/**/*.csproj", "src/**/package.json" }), + CacheKeyFiles = new[] { "global.json", "src/**/*.csproj", "src/**/package.json" }, + JobConcurrencyCancelInProgress = true), ] [CustomGitHubActions( "build", - GitHubActionsImage.WindowsServer2022, + GitHubActionsImage.WindowsLatest, // GitHubActionsImage.UbuntuLatest, // GitHubActionsImage.MacOsLatest, OnPushBranches = new[] { "master", "main" }, @@ -47,13 +47,6 @@ protected override GitHubActionsJob GetJobs(GitHubActionsImage image, IReadOnlyC var newSteps = new List(job.Steps); - // only need to list the ones that are missing from default image - newSteps.Insert(0, new GitHubActionsSetupDotNetStep(new[] - { - "2.1.*", - "5.0.*" - })); - newSteps.Insert(0, new GitHubActionsUseGnuTarStep()); newSteps.Insert(0, new GitHubActionsConfigureLongPathsStep()); diff --git a/build/Build.Pack.cs b/build/Build.Pack.cs index 7883cd9682..0924ad2f9f 100644 --- a/build/Build.Pack.cs +++ b/build/Build.Pack.cs @@ -37,7 +37,7 @@ public partial class Build nugetVersion += "-" + VersionSuffix; } - EnsureCleanDirectory(ArtifactsDirectory); + ArtifactsDirectory.CreateOrCleanDirectory(); // it seems to cause some headache with publishing, so let's dotnet pack only files we know are suitable var projects = SourceDirectory.GlobFiles("**/*.csproj") @@ -70,10 +70,10 @@ public partial class Build Serilog.Log.Information("Build WiX installer"); - EnsureCleanDirectory(SourceDirectory / "NSwagStudio.Installer" / "bin"); + (SourceDirectory / "NSwagStudio.Installer" / "bin").CreateOrCleanDirectory(); MSBuild(x => x - .SetTargetPath(Solution.GetProject("NSwagStudio.Installer")) + .SetTargetPath(GetProject("NSwagStudio.Installer")) .SetTargets("Rebuild") .SetAssemblyVersion(VersionPrefix) .SetFileVersion(VersionPrefix) @@ -90,9 +90,9 @@ public partial class Build Serilog.Log.Information("Package nuspecs"); var apiDescriptionClientNuSpec = SourceDirectory / "NSwag.ApiDescription.Client" / "NSwag.ApiDescription.Client.nuspec"; - var content = TextTasks.ReadAllText(apiDescriptionClientNuSpec); + var content = apiDescriptionClientNuSpec.ReadAllText(); content = content.Replace("", ""); - TextTasks.WriteAllText(apiDescriptionClientNuSpec, content); + apiDescriptionClientNuSpec.WriteAllText(content); var nuspecs = new[] { @@ -122,9 +122,9 @@ public partial class Build // patch npm version var npmPackagesFile = SourceDirectory / "NSwag.Npm" / "package.json"; - content = TextTasks.ReadAllText(npmPackagesFile); + content = npmPackagesFile.ReadAllText(); content = Regex.Replace(content, @"""version"": "".*""", @"""version"": """ + nugetVersion + @""""); - TextTasks.WriteAllText(npmPackagesFile, content); + npmPackagesFile.WriteAllText(content); // ZIP directories ZipFile.CreateFromDirectory(NSwagNpmBinaries, ArtifactsDirectory / "NSwag.Npm.zip"); diff --git a/build/Build.cs b/build/Build.cs index d5fc84a727..b3257b1c58 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -12,7 +12,6 @@ using Nuke.Common.Tools.DotNet; using Nuke.Common.Tools.MSBuild; using Nuke.Common.Tools.Npm; -using Nuke.Common.Tools.VSTest; using Nuke.Common.Utilities.Collections; using static Nuke.Common.IO.FileSystemTasks; @@ -76,7 +75,7 @@ string DetermineVersionPrefix() } else { - var propsDocument = XDocument.Parse(TextTasks.ReadAllText(SourceDirectory / "Directory.Build.props")); + var propsDocument = XDocument.Parse((SourceDirectory / "Directory.Build.props").ReadAllText()); versionPrefix = propsDocument.Element("Project").Element("PropertyGroup").Element("VersionPrefix").Value; Serilog.Log.Information("Version prefix {VersionPrefix} read from Directory.Build.props", versionPrefix); } @@ -117,19 +116,15 @@ protected override void OnBuildInitialized() .Before(Restore) .Executes(() => { - SourceDirectory.GlobDirectories("**/bin", "**/obj").ForEach(DeleteDirectory); - EnsureCleanDirectory(ArtifactsDirectory); + SourceDirectory.GlobDirectories("**/bin", "**/obj").ForEach(x => x.DeleteDirectory()); + ArtifactsDirectory.CreateOrCleanDirectory(); }); - Target InstallDependencies => _ => _ .Before(Restore, Compile) .Executes(() => { Chocolatey("install wixtoolset -y"); - Chocolatey("install dotnetcore-3.1-sdk -y"); - Chocolatey("install netfx-4.6.2-devpack -y"); - Chocolatey("install dotnet-7.0-sdk -y"); NpmInstall(x => x .EnableGlobal() .AddPackages("dotnettools") @@ -157,18 +152,19 @@ protected override void OnBuildInitialized() ); }); + // logic from 01_Build.bat Target Compile => _ => _ .DependsOn(Restore) .Executes(() => { - EnsureCleanDirectory(SourceDirectory / "NSwag.Npm" / "bin" / "binaries"); - EnsureCleanDirectory(NSwagStudioBinaries); + (SourceDirectory / "NSwag.Npm" / "bin" / "binaries").CreateOrCleanDirectory(); + NSwagStudioBinaries.CreateOrCleanDirectory(); Serilog.Log.Information("Build and copy full .NET command line with configuration {Configuration}", Configuration); // TODO: Fix build here MSBuild(x => x - .SetProjectFile(Solution.GetProject("NSwagStudio")) + .SetProjectFile(GetProject("NSwagStudio")) .SetTargets("Build") .SetAssemblyVersion(VersionPrefix) .SetFileVersion(VersionPrefix) @@ -215,9 +211,9 @@ protected override void OnBuildInitialized() void PublishAndCopyConsoleProjects() { - var consoleCoreProject = Solution.GetProject("NSwag.ConsoleCore"); - var consoleX86Project = Solution.GetProject("NSwag.Console.x86"); - var consoleProject = Solution.GetProject("NSwag.Console"); + var consoleCoreProject = GetProject("NSwag.ConsoleCore"); + var consoleX86Project = GetProject("NSwag.Console.x86"); + var consoleProject = GetProject("NSwag.Console"); Serilog.Log.Information("Publish command line projects"); @@ -240,7 +236,7 @@ void PublishConsoleProject(Project project, string[] targetFrameworks) PublishConsoleProject(consoleX86Project, new[] { "net462" }); PublishConsoleProject(consoleProject, new[] { "net462" }); - PublishConsoleProject(consoleCoreProject, new[] { "netcoreapp3.1", "net6.0", "net7.0" }); + PublishConsoleProject(consoleCoreProject, new[] { "net6.0", "net7.0" }); void CopyConsoleBinaries(AbsolutePath target) { @@ -252,7 +248,6 @@ void CopyConsoleBinaries(AbsolutePath target) CopyDirectoryRecursively(consoleProject.Directory / "bin" / Configuration / "net462" / "publish", target / "Win", DirectoryExistsPolicy.Merge); var consoleCoreDirectory = consoleCoreProject.Directory / "bin" / Configuration; - CopyDirectoryRecursively(consoleCoreDirectory / "netcoreapp3.1" / "publish", target / "NetCore31"); CopyDirectoryRecursively(consoleCoreDirectory / "net6.0" / "publish", target / "Net60"); CopyDirectoryRecursively(consoleCoreDirectory / "net7.0" / "publish", target / "Net70"); } @@ -276,4 +271,8 @@ DotNetBuildSettings BuildDefaults(DotNetBuildSettings s) .SetDeterministic(IsServerBuild) .SetContinuousIntegrationBuild(IsServerBuild); } + + // Solution.GetProject only returns solution's direct descendants since NUKE 7.0.1 + private Project GetProject(string projectName) => + Solution.AllProjects.FirstOrDefault(x => x.Name == projectName) ?? throw new ArgumentException($"Could not find project {projectName} from solution"); } diff --git a/build/_build.csproj b/build/_build.csproj index 15037410bf..95d236e770 100644 --- a/build/_build.csproj +++ b/build/_build.csproj @@ -11,7 +11,7 @@ - + diff --git a/src/NSwag.Annotations/NSwag.Annotations.csproj b/src/NSwag.Annotations/NSwag.Annotations.csproj index 09b9c81c4b..9ca4410208 100644 --- a/src/NSwag.Annotations/NSwag.Annotations.csproj +++ b/src/NSwag.Annotations/NSwag.Annotations.csproj @@ -1,13 +1,9 @@  - netstandard2.0;net462 + net462;netstandard2.0 - + bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml - - - - \ No newline at end of file diff --git a/src/NSwag.AspNet.Owin/NSwag.AspNet.Owin.csproj b/src/NSwag.AspNet.Owin/NSwag.AspNet.Owin.csproj index 62b85be6f7..5c07dbd1a3 100644 --- a/src/NSwag.AspNet.Owin/NSwag.AspNet.Owin.csproj +++ b/src/NSwag.AspNet.Owin/NSwag.AspNet.Owin.csproj @@ -1,12 +1,10 @@  net462 - - - bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml + $(DefineConstants);AspNetOwin - + @@ -19,15 +17,7 @@ - - - TRACE;DEBUG;AspNetOwin - - - - TRACE;RELEASE;AspNetOwin - - + @@ -37,14 +27,13 @@ - + - - + diff --git a/src/NSwag.AspNet.WebApi/NSwag.AspNet.WebApi.csproj b/src/NSwag.AspNet.WebApi/NSwag.AspNet.WebApi.csproj index 8c432c794f..c0681bc82c 100644 --- a/src/NSwag.AspNet.WebApi/NSwag.AspNet.WebApi.csproj +++ b/src/NSwag.AspNet.WebApi/NSwag.AspNet.WebApi.csproj @@ -10,7 +10,6 @@ - diff --git a/src/NSwag.AspNetCore.Launcher/NSwag.AspNetCore.Launcher.csproj b/src/NSwag.AspNetCore.Launcher/NSwag.AspNetCore.Launcher.csproj index 6e35fa8d45..e0cf5ce4e2 100644 --- a/src/NSwag.AspNetCore.Launcher/NSwag.AspNetCore.Launcher.csproj +++ b/src/NSwag.AspNetCore.Launcher/NSwag.AspNetCore.Launcher.csproj @@ -1,12 +1,12 @@  - netcoreapp3.1;net462 + net6.0;net462 x64 Exe false - + \ No newline at end of file diff --git a/src/NSwag.AspNetCore/NSwag.AspNetCore.csproj b/src/NSwag.AspNetCore/NSwag.AspNetCore.csproj index 822c22ca9c..b982a4e719 100644 --- a/src/NSwag.AspNetCore/NSwag.AspNetCore.csproj +++ b/src/NSwag.AspNetCore/NSwag.AspNetCore.csproj @@ -1,6 +1,7 @@  - net462;netstandard2.0;netcoreapp3.1;net6.0;net7.0 + net462;netstandard2.0;net6.0;net7.0 + Swagger Documentation AspNetCore NetCore TypeScript CodeGen $(MSBuildProjectName).nuspec symbols.nupkg @@ -20,49 +21,40 @@ 4.3.0 4.0.1 - + bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml - + - + - + - - - - - - - - - - + - + - + diff --git a/src/NSwag.AspNetCore/NSwag.AspNetCore.nuspec b/src/NSwag.AspNetCore/NSwag.AspNetCore.nuspec index 889de271d5..9a6d32a5df 100644 --- a/src/NSwag.AspNetCore/NSwag.AspNetCore.nuspec +++ b/src/NSwag.AspNetCore/NSwag.AspNetCore.nuspec @@ -11,7 +11,7 @@ NuGetIcon.png - + @@ -23,21 +23,6 @@ - @@ -52,15 +37,6 @@ - - - - - - - - - @@ -89,8 +65,6 @@ - - diff --git a/src/NSwag.CodeGeneration.CSharp.Tests/NSwag.CodeGeneration.CSharp.Tests.csproj b/src/NSwag.CodeGeneration.CSharp.Tests/NSwag.CodeGeneration.CSharp.Tests.csproj index 4bb353b27b..a0a09dbc96 100644 --- a/src/NSwag.CodeGeneration.CSharp.Tests/NSwag.CodeGeneration.CSharp.Tests.csproj +++ b/src/NSwag.CodeGeneration.CSharp.Tests/NSwag.CodeGeneration.CSharp.Tests.csproj @@ -1,15 +1,12 @@ - - + net7.0 - - diff --git a/src/NSwag.CodeGeneration.CSharp/NSwag.CodeGeneration.CSharp.csproj b/src/NSwag.CodeGeneration.CSharp/NSwag.CodeGeneration.CSharp.csproj index 86b41c78b0..d9fcc7b3ee 100644 --- a/src/NSwag.CodeGeneration.CSharp/NSwag.CodeGeneration.CSharp.csproj +++ b/src/NSwag.CodeGeneration.CSharp/NSwag.CodeGeneration.CSharp.csproj @@ -2,23 +2,19 @@ netstandard2.0;net462 - + bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml - + - - - - - + - + diff --git a/src/NSwag.CodeGeneration.Tests/NSwag.CodeGeneration.Tests.csproj b/src/NSwag.CodeGeneration.Tests/NSwag.CodeGeneration.Tests.csproj index 8c9cf1425c..c62d772886 100644 --- a/src/NSwag.CodeGeneration.Tests/NSwag.CodeGeneration.Tests.csproj +++ b/src/NSwag.CodeGeneration.Tests/NSwag.CodeGeneration.Tests.csproj @@ -4,12 +4,10 @@ - - + - diff --git a/src/NSwag.CodeGeneration.TypeScript.Tests/NSwag.CodeGeneration.TypeScript.Tests.csproj b/src/NSwag.CodeGeneration.TypeScript.Tests/NSwag.CodeGeneration.TypeScript.Tests.csproj index 9b8d298348..f656af7c27 100644 --- a/src/NSwag.CodeGeneration.TypeScript.Tests/NSwag.CodeGeneration.TypeScript.Tests.csproj +++ b/src/NSwag.CodeGeneration.TypeScript.Tests/NSwag.CodeGeneration.TypeScript.Tests.csproj @@ -1,14 +1,12 @@ - + net7.0 - - diff --git a/src/NSwag.CodeGeneration.TypeScript/NSwag.CodeGeneration.TypeScript.csproj b/src/NSwag.CodeGeneration.TypeScript/NSwag.CodeGeneration.TypeScript.csproj index d999cc7827..cc72e77bef 100644 --- a/src/NSwag.CodeGeneration.TypeScript/NSwag.CodeGeneration.TypeScript.csproj +++ b/src/NSwag.CodeGeneration.TypeScript/NSwag.CodeGeneration.TypeScript.csproj @@ -11,10 +11,6 @@ - - - - diff --git a/src/NSwag.CodeGeneration/NSwag.CodeGeneration.csproj b/src/NSwag.CodeGeneration/NSwag.CodeGeneration.csproj index f1204ef7f8..054195d788 100644 --- a/src/NSwag.CodeGeneration/NSwag.CodeGeneration.csproj +++ b/src/NSwag.CodeGeneration/NSwag.CodeGeneration.csproj @@ -8,15 +8,9 @@ - - - - - - diff --git a/src/NSwag.Commands/HostApplication.cs b/src/NSwag.Commands/HostApplication.cs index 343680b4ac..840b2dca8b 100644 --- a/src/NSwag.Commands/HostApplication.cs +++ b/src/NSwag.Commands/HostApplication.cs @@ -92,7 +92,7 @@ public static IServiceProvider GetServiceProvider(Assembly assembly) internal static IServiceProvider GetServiceProviderWithHostFactoryResolver(Assembly assembly) { -#if NETCOREAPP2_1 || NETFRAMEWORK +#if NETFRAMEWORK return null; #else // We're disabling the default server and the console host lifetime. This will disable: diff --git a/src/NSwag.Commands/NSwag.Commands.csproj b/src/NSwag.Commands/NSwag.Commands.csproj index 7f4ef0ea72..64cc900a02 100644 --- a/src/NSwag.Commands/NSwag.Commands.csproj +++ b/src/NSwag.Commands/NSwag.Commands.csproj @@ -1,61 +1,40 @@  + - net462;netcoreapp3.1;net6.0;net7.0 + net462;net6.0;net7.0 bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml $(NoWarn),618,1591 - + - - - - - - - - - - - - - - + - + - + - + - - - - - - - - - - + @@ -67,4 +46,5 @@ - \ No newline at end of file + + diff --git a/src/NSwag.Commands/NSwagDocument.cs b/src/NSwag.Commands/NSwagDocument.cs index a31fdede8d..7f4526821a 100644 --- a/src/NSwag.Commands/NSwagDocument.cs +++ b/src/NSwag.Commands/NSwagDocument.cs @@ -239,11 +239,7 @@ private string GetArgumentsPrefix() #if NET462 var runtime = Runtime != Runtime.Default ? Runtime : RuntimeUtilities.CurrentRuntime; - if (runtime == Runtime.NetCore31) - { - return "\"" + System.IO.Path.Combine(RootBinaryDirectory, "NetCore31/dotnet-nswag.dll") + "\" "; - } - else if (runtime == Runtime.Net60) + if (runtime == Runtime.Net60) { return "\"" + System.IO.Path.Combine(RootBinaryDirectory, "Net60/dotnet-nswag.dll") + "\" "; } diff --git a/src/NSwag.Commands/Runtime.cs b/src/NSwag.Commands/Runtime.cs index f3b3f2b19b..63b5569335 100644 --- a/src/NSwag.Commands/Runtime.cs +++ b/src/NSwag.Commands/Runtime.cs @@ -20,9 +20,6 @@ public enum Runtime /// Full .NET framework, x86. WinX86, - /// .NET Core 3.1 app. - NetCore31, - /// .NET 6 app. Net60, diff --git a/src/NSwag.Commands/RuntimeUtilities.cs b/src/NSwag.Commands/RuntimeUtilities.cs index bd57f17c00..71370da34d 100644 --- a/src/NSwag.Commands/RuntimeUtilities.cs +++ b/src/NSwag.Commands/RuntimeUtilities.cs @@ -29,14 +29,11 @@ public static Runtime CurrentRuntime { return Runtime.Net70; } - else if (framework.Version.Major >= 6) + + if (framework.Version.Major >= 6) { return Runtime.Net60; } - else if (framework.Version.Major >= 3) - { - return Runtime.NetCore31; - } return Runtime.Net60; } diff --git a/src/NSwag.Console.x86/NSwag.Console.x86.csproj b/src/NSwag.Console.x86/NSwag.Console.x86.csproj index 198ccb4fed..6f9a6f16b5 100644 --- a/src/NSwag.Console.x86/NSwag.Console.x86.csproj +++ b/src/NSwag.Console.x86/NSwag.Console.x86.csproj @@ -10,19 +10,13 @@ x86 true - - - TRACE;DEBUG;net46 - - - + - @@ -30,14 +24,14 @@ - + - + ..\libs\System.IO.dll diff --git a/src/NSwag.Console/NSwag.Console.csproj b/src/NSwag.Console/NSwag.Console.csproj index 05af4e1a73..50ff11ccc9 100644 --- a/src/NSwag.Console/NSwag.Console.csproj +++ b/src/NSwag.Console/NSwag.Console.csproj @@ -9,23 +9,9 @@ NSwag true - - - TRACE;DEBUG;net462 - - - - bin\$(Configuration)\ - - - - bin\$(Configuration)\ - - - @@ -33,14 +19,14 @@ - + - + ..\libs\System.IO.dll diff --git a/src/NSwag.ConsoleCore/NSwag.ConsoleCore.csproj b/src/NSwag.ConsoleCore/NSwag.ConsoleCore.csproj index 0ff826ddcd..616cd42a2e 100644 --- a/src/NSwag.ConsoleCore/NSwag.ConsoleCore.csproj +++ b/src/NSwag.ConsoleCore/NSwag.ConsoleCore.csproj @@ -1,6 +1,6 @@  - netcoreapp3.1;net6.0;net7.0 + net6.0;net7.0 Exe dotnet-nswag NSwag.ConsoleCore @@ -13,21 +13,16 @@ - - - - - - + - + diff --git a/src/NSwag.Core.Yaml/NSwag.Core.Yaml.csproj b/src/NSwag.Core.Yaml/NSwag.Core.Yaml.csproj index 77f2928146..794775afef 100644 --- a/src/NSwag.Core.Yaml/NSwag.Core.Yaml.csproj +++ b/src/NSwag.Core.Yaml/NSwag.Core.Yaml.csproj @@ -6,7 +6,6 @@ - diff --git a/src/NSwag.Core/NSwag.Core.csproj b/src/NSwag.Core/NSwag.Core.csproj index dd28fd5ad8..03a2d9afa8 100644 --- a/src/NSwag.Core/NSwag.Core.csproj +++ b/src/NSwag.Core/NSwag.Core.csproj @@ -1,24 +1,14 @@  - netstandard2.0;net462 + net462;netstandard2.0 NSwag - + bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml - + - - - - - - - - - - \ No newline at end of file diff --git a/src/NSwag.Generation.AspNetCore.Tests.Web/NSwag.Generation.AspNetCore.Tests.Web.csproj b/src/NSwag.Generation.AspNetCore.Tests.Web/NSwag.Generation.AspNetCore.Tests.Web.csproj index 64cc4e48b8..347e194d95 100644 --- a/src/NSwag.Generation.AspNetCore.Tests.Web/NSwag.Generation.AspNetCore.Tests.Web.csproj +++ b/src/NSwag.Generation.AspNetCore.Tests.Web/NSwag.Generation.AspNetCore.Tests.Web.csproj @@ -1,10 +1,10 @@  - net6.0;net7.0;netcoreapp3.1 + net6.0;net7.0 true $(NoWarn),618,1591 - enable + enable diff --git a/src/NSwag.Generation.AspNetCore.Tests.Web/Startup.cs b/src/NSwag.Generation.AspNetCore.Tests.Web/Startup.cs index a85dd0c0f2..3b4a6ed061 100644 --- a/src/NSwag.Generation.AspNetCore.Tests.Web/Startup.cs +++ b/src/NSwag.Generation.AspNetCore.Tests.Web/Startup.cs @@ -1,6 +1,5 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.AspNetCore.Mvc.Versioning; @@ -18,27 +17,6 @@ public Startup(IConfiguration configuration) public void ConfigureServices(IServiceCollection services) { -#if NETCOREAPP2_1 - services - .AddMvc(config => - { - config.InputFormatters.Add(new CustomTextInputFormatter()); - config.OutputFormatters.Add(new CustomTextOutputFormatter()); - }) - .SetCompatibilityVersion(CompatibilityVersion.Version_2_1); - - services.AddApiVersioning(options => - { - options.AssumeDefaultVersionWhenUnspecified = true; - options.ApiVersionReader = new UrlSegmentApiVersionReader(); - }) - .AddMvcCore() - .AddVersionedApiExplorer(options => - { - options.GroupNameFormat = "VVV"; - options.SubstituteApiVersionInUrl = true; - }); -#else services .AddControllers(config => { @@ -55,8 +33,7 @@ public void ConfigureServices(IServiceCollection services) { options.GroupNameFormat = "VVV"; options.SubstituteApiVersionInUrl = true; - }); -#endif + }); services .AddSwaggerDocument(document => @@ -88,16 +65,11 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env) } app.UseHttpsRedirection(); -#if NETCOREAPP2_1 - app.UseMvc(); -#else app.UseRouting(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); -#endif - app.UseSwagger(); app.UseSwaggerUi3(); diff --git a/src/NSwag.Generation.AspNetCore.Tests/NSwag.Generation.AspNetCore.Tests.csproj b/src/NSwag.Generation.AspNetCore.Tests/NSwag.Generation.AspNetCore.Tests.csproj index 01165d087e..7ac1896dad 100644 --- a/src/NSwag.Generation.AspNetCore.Tests/NSwag.Generation.AspNetCore.Tests.csproj +++ b/src/NSwag.Generation.AspNetCore.Tests/NSwag.Generation.AspNetCore.Tests.csproj @@ -1,9 +1,8 @@ - + - netcoreapp3.1;net6.0;net7.0 + net6.0;net7.0 $(NoWarn),618,1591 - @@ -12,12 +11,10 @@ - - - + @@ -27,4 +24,5 @@ + diff --git a/src/NSwag.Generation.AspNetCore/NSwag.Generation.AspNetCore.csproj b/src/NSwag.Generation.AspNetCore/NSwag.Generation.AspNetCore.csproj index d1bd22a5ac..9a4b6ebf84 100644 --- a/src/NSwag.Generation.AspNetCore/NSwag.Generation.AspNetCore.csproj +++ b/src/NSwag.Generation.AspNetCore/NSwag.Generation.AspNetCore.csproj @@ -1,41 +1,30 @@  - net462;netstandard2.0;netcoreapp3.1;net6.0;net7.0 + net462;netstandard2.0;net6.0;net7.0 Swagger Documentation AspNetCore $(DefineConstants);ASPNETCORE bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml - + - - - - - - - - + + - - - - - - + - \ No newline at end of file + diff --git a/src/NSwag.Generation.Tests/NSwag.Generation.Tests.csproj b/src/NSwag.Generation.Tests/NSwag.Generation.Tests.csproj index 074dc14e19..8e2f5e6c49 100644 --- a/src/NSwag.Generation.Tests/NSwag.Generation.Tests.csproj +++ b/src/NSwag.Generation.Tests/NSwag.Generation.Tests.csproj @@ -11,7 +11,6 @@ - diff --git a/src/NSwag.Generation.WebApi/NSwag.Generation.WebApi.csproj b/src/NSwag.Generation.WebApi/NSwag.Generation.WebApi.csproj index 1e4ada5c78..ec0dd7a148 100644 --- a/src/NSwag.Generation.WebApi/NSwag.Generation.WebApi.csproj +++ b/src/NSwag.Generation.WebApi/NSwag.Generation.WebApi.csproj @@ -1,24 +1,12 @@  + - netstandard2.0;net462 + net462;netstandard2.0 bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml - - - - - - - - - - - - - - - + - \ No newline at end of file + + diff --git a/src/NSwag.Generation/NSwag.Generation.csproj b/src/NSwag.Generation/NSwag.Generation.csproj index 1a9b9cbda6..8dfd868ac5 100644 --- a/src/NSwag.Generation/NSwag.Generation.csproj +++ b/src/NSwag.Generation/NSwag.Generation.csproj @@ -5,17 +5,13 @@ $(NoWarn),618 - + - - + - - - - - + + \ No newline at end of file diff --git a/src/NSwag.MSBuild/NSwag.MSBuild.nuspec b/src/NSwag.MSBuild/NSwag.MSBuild.nuspec index 3feb31126e..dded2467a9 100644 --- a/src/NSwag.MSBuild/NSwag.MSBuild.nuspec +++ b/src/NSwag.MSBuild/NSwag.MSBuild.nuspec @@ -28,8 +28,7 @@ - - - + + diff --git a/src/NSwag.MSBuild/NSwag.MSBuild.props b/src/NSwag.MSBuild/NSwag.MSBuild.props index e60a59d7a3..8cc764e2fe 100644 --- a/src/NSwag.MSBuild/NSwag.MSBuild.props +++ b/src/NSwag.MSBuild/NSwag.MSBuild.props @@ -3,16 +3,10 @@ "$(MSBuildThisFileDirectory)../tools/Win/NSwag.exe" "$(MSBuildThisFileDirectory)../tools/Win/NSwag.x86.exe" - dotnet "$(MSBuildThisFileDirectory)../tools/NetCore21/dotnet-nswag.dll" - dotnet "$(MSBuildThisFileDirectory)../tools/NetCore31/dotnet-nswag.dll" - dotnet "$(MSBuildThisFileDirectory)../tools/Net50/dotnet-nswag.dll" dotnet "$(MSBuildThisFileDirectory)../tools/Net60/dotnet-nswag.dll" dotnet "$(MSBuildThisFileDirectory)../tools/Net70/dotnet-nswag.dll" $(MSBuildThisFileDirectory)../tools/Win/ - $(MSBuildThisFileDirectory)../tools/NetCore21/ - $(MSBuildThisFileDirectory)../tools/NetCore31/ - $(MSBuildThisFileDirectory)../tools/Net50/ $(MSBuildThisFileDirectory)../tools/Net60/ $(MSBuildThisFileDirectory)../tools/Net70/ diff --git a/src/NSwag.Npm/README.md b/src/NSwag.Npm/README.md index d12538194c..2876710bc0 100644 --- a/src/NSwag.Npm/README.md +++ b/src/NSwag.Npm/README.md @@ -39,19 +39,11 @@ Add the switch `/runtime:NetCore*` to the command to execute one of the .NET Cor To specify what .NET Core binaries to execute, either use (default) - nswag version /runtime:NetCore21 - -or - - nswag version /runtime:NetCore31 - -or - - nswag version /runtime:Net50 + nswag version /runtime:Net60 or - nswag version /runtime:Net60 + nswag version /runtime:Net70 ## Development diff --git a/src/NSwag.Npm/bin/nswag.js b/src/NSwag.Npm/bin/nswag.js index 90d727b77e..86f189e4ff 100644 --- a/src/NSwag.Npm/bin/nswag.js +++ b/src/NSwag.Npm/bin/nswag.js @@ -3,11 +3,6 @@ var defaultCoreVersion = "Net70"; var supportedCoreVersions = [ - { ver: '2.1', dir: "NetCore21", }, - { ver: '2.2', dir: "NetCore22", }, - { ver: '3.0', dir: "NetCore30", }, - { ver: '3.1', dir: "NetCore31", }, - { ver: '5.0', dir: "Net50", }, { ver: '6.0', dir: "Net60", }, { ver: '7.0', dir: "Net70", }, ]; @@ -20,9 +15,6 @@ var args = process.argv.splice(2, process.argv.length - 2).map(function (a) { re // Legacy support args = args.replace("--x86", "/runtime:WinX86"); args = args.replace("/runtime:x86", "/runtime:WinX86"); -args = args.replace("--core 2.1", "/runtime:NetCore21"); -args = args.replace("--core 3.1", "/runtime:NetCore31"); -args = args.replace("--core 5.0", "/runtime:Net50"); args = args.replace("--core 6.0", "/runtime:Net60"); args = args.replace("--core 7.0", "/runtime:Net70"); args = args.replace("--core", "/runtime:" + defaultCoreVersion); diff --git a/src/NSwag.Sample.Common/NSwag.Sample.Common.csproj b/src/NSwag.Sample.Common/NSwag.Sample.Common.csproj index 9eca547297..eb7e0662cf 100644 --- a/src/NSwag.Sample.Common/NSwag.Sample.Common.csproj +++ b/src/NSwag.Sample.Common/NSwag.Sample.Common.csproj @@ -1,7 +1,7 @@  - netstandard1.4 + netstandard2.0 \ No newline at end of file diff --git a/src/NSwag.Sample.NET70/NSwag.Sample.NET70.csproj b/src/NSwag.Sample.NET70/NSwag.Sample.NET70.csproj index 95dd2ac216..7ffd30eec6 100644 --- a/src/NSwag.Sample.NET70/NSwag.Sample.NET70.csproj +++ b/src/NSwag.Sample.NET70/NSwag.Sample.NET70.csproj @@ -5,10 +5,6 @@ enable - - - - diff --git a/src/NSwag.VersionMissmatchTest/App.config b/src/NSwag.VersionMissmatchTest/App.config index 3a16ba8580..a068fd13fb 100644 --- a/src/NSwag.VersionMissmatchTest/App.config +++ b/src/NSwag.VersionMissmatchTest/App.config @@ -1,7 +1,7 @@ - + diff --git a/src/NSwagStudio/App.config b/src/NSwagStudio/App.config index 57b0b8bb1f..a5cce42e99 100644 --- a/src/NSwagStudio/App.config +++ b/src/NSwagStudio/App.config @@ -1,7 +1,7 @@  - + diff --git a/src/NSwagStudio/nswag.cmd b/src/NSwagStudio/nswag.cmd index 4240197fd6..781e0ccf40 100644 --- a/src/NSwagStudio/nswag.cmd +++ b/src/NSwagStudio/nswag.cmd @@ -6,21 +6,6 @@ IF NOT "%args:/runtime:winx86=%" == "%args%" ( GOTO end ) -IF NOT "%args:/runtime:netcore21=%" == "%args%" ( - dotnet "%~dp0/NetCore21/dotnet-nswag.dll" %* - GOTO end -) - -IF NOT "%args:/runtime:netcore31=%" == "%args%" ( - dotnet "%~dp0/NetCore31/dotnet-nswag.dll" %* - GOTO end -) - -IF NOT "%args:/runtime:net50=%" == "%args%" ( - dotnet "%~dp0/Net50/dotnet-nswag.dll" %* - GOTO end -) - IF NOT "%args:/runtime:net60=%" == "%args%" ( dotnet "%~dp0/Net60/dotnet-nswag.dll" %* GOTO end