Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Net462update #4227

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions build/Build.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
using System;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Xml.Linq;
using Microsoft.Build.Evaluation;
using Microsoft.Build.Locator;
using Nuke.Common;
Expand All @@ -16,9 +11,12 @@
using Nuke.Common.Tools.Npm;
using Nuke.Common.Tools.VSTest;
using Nuke.Common.Utilities.Collections;

using System;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Xml.Linq;
using static Nuke.Common.IO.FileSystemTasks;
using static Nuke.Common.Logger;
using static Nuke.Common.Tooling.ProcessTasks;
using static Nuke.Common.Tools.Chocolatey.ChocolateyTasks;
using static Nuke.Common.Tools.DotNet.DotNetTasks;
Expand Down Expand Up @@ -106,7 +104,7 @@ protected override void OnBuildInitialized()
Serilog.Log.Information("BUILD SETUP");
Serilog.Log.Information("Configuration:\t{Configuration}", Configuration);
Serilog.Log.Information("Version prefix:\t{VersionPrefix}", VersionPrefix);
Serilog.Log.Information("Version suffix:\t{VersionSuffix}",VersionSuffix);
Serilog.Log.Information("Version suffix:\t{VersionSuffix}", VersionSuffix);
Serilog.Log.Information("Tagged build:\t{IsTaggedBuild}", IsTaggedBuild);
}

Expand Down Expand Up @@ -353,9 +351,9 @@ void PublishConsoleProject(Nuke.Common.ProjectModel.Project project, string[] ta
}
}

PublishConsoleProject(consoleX86Project, new[] { "net461" });
PublishConsoleProject(consoleProject, new[] { "net461" });
PublishConsoleProject(consoleCoreProject, new[] { "netcoreapp2.1", "netcoreapp3.1", "net5.0", "net6.0" });
PublishConsoleProject(consoleX86Project, new[] { "net462" });
PublishConsoleProject(consoleProject, new[] { "net462" });
PublishConsoleProject(consoleCoreProject, new[] { "netcoreapp3.1", "net5.0", "net6.0" });

void CopyConsoleBinaries(AbsolutePath target)
{
Expand All @@ -367,7 +365,6 @@ void CopyConsoleBinaries(AbsolutePath target)
CopyDirectoryRecursively(consoleProject.Directory / "bin" / Configuration / "net461" / "publish", target / "Win", DirectoryExistsPolicy.Merge);

var consoleCoreDirectory = consoleCoreProject.Directory / "bin" / Configuration;
CopyDirectoryRecursively(consoleCoreDirectory / "netcoreapp2.1" / "publish", target / "NetCore21");
CopyDirectoryRecursively(consoleCoreDirectory / "netcoreapp3.1" / "publish", target / "NetCore31");
CopyDirectoryRecursively(consoleCoreDirectory / "net5.0" / "publish", target / "Net50");
CopyDirectoryRecursively(consoleCoreDirectory / "net6.0" / "publish", target / "Net60");
Expand Down
4 changes: 2 additions & 2 deletions src/NSwag.Annotations/NSwag.Annotations.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard1.0;net45;netstandard2.0</TargetFrameworks>
<TargetFrameworks>netstandard1.0;net462;netstandard2.0</TargetFrameworks>
</PropertyGroup>
<PropertyGroup>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net45'">
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
</Project>
10 changes: 5 additions & 5 deletions src/NSwag.AspNet.Owin/NSwag.AspNet.Owin.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net45</TargetFramework>
<TargetFramework>net462</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
Expand All @@ -17,11 +17,11 @@
<EmbeddedResource Include="SwaggerUi3\swagger-ui.css" />
<EmbeddedResource Include="SwaggerUi3\swagger-ui.js" />
</ItemGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net45|AnyCPU'">
<DefineConstants>TRACE;DEBUG;AspNetOwin;NET45</DefineConstants>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net462|AnyCPU'">
<DefineConstants>TRACE;DEBUG;AspNetOwin;NET462</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net45|AnyCPU'">
<DefineConstants>TRACE;RELEASE;AspNetOwin;NET45</DefineConstants>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net462|AnyCPU'">
<DefineConstants>TRACE;RELEASE;AspNetOwin;NET462</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\NSwag.AspNetCore\HttpRequestExtension.cs" Link="HttpRequestExtension.cs" />
Expand Down
6 changes: 3 additions & 3 deletions src/NSwag.AspNet.WebApi/NSwag.AspNet.WebApi.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net45</TargetFramework>
<TargetFramework>net462</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net45|AnyCPU'">
<DefineConstants>TRACE;DEBUG;NET45</DefineConstants>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net462|AnyCPU'">
<DefineConstants>TRACE;DEBUG;NET462</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.2.3" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net461</TargetFramework>
<TargetFramework>net462</TargetFramework>
<PlatformTarget>x86</PlatformTarget>
<OutputType>Exe</OutputType>
<IsPackable>false</IsPackable>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net461</TargetFrameworks>
<PlatformTarget Condition="'$(TargetFramework)'=='net461'">x64</PlatformTarget>
<TargetFrameworks>netcoreapp3.1;net462</TargetFrameworks>
<PlatformTarget Condition="'$(TargetFramework)'=='net462'">x64</PlatformTarget>
<OutputType>Exe</OutputType>
<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
10 changes: 3 additions & 7 deletions src/NSwag.AspNetCore/NSwag.AspNetCore.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net461;netstandard1.6;netstandard2.0;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<TargetFrameworks>net462;netstandard1.6;netstandard2.0;netcoreapp3.1;net6.0</TargetFrameworks>
<PackageTags>Swagger Documentation AspNetCore NetCore TypeScript CodeGen</PackageTags>
<NuspecFile>$(MSBuildProjectName).nuspec</NuspecFile>
<SymbolPackageFormat>symbols.nupkg</SymbolPackageFormat>
Expand Down Expand Up @@ -29,7 +29,7 @@
<EmbeddedResource Include="SwaggerUi\**\*" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" />
<EmbeddedResource Include="SwaggerUi3\**\*" Exclude="bin\**;obj\**;**\*.xproj;packages\**;@(EmbeddedResource)" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net461' OR '$(TargetFramework)' == 'netstandard1.6' OR '$(TargetFramework)' == 'netstandard2.0' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'net462' OR '$(TargetFramework)' == 'netstandard1.6' OR '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="$(MicrosoftExtensionsFileProvidersEmbeddedPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="$(MicrosoftAspNetCoreMvcCorePackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Formatters.Json" Version="$(MicrosoftAspNetCoreMvcFormattersJsonPackageVersion)" />
Expand All @@ -39,17 +39,13 @@
<PackageReference Include="System.IO.FileSystem" Version="$(SystemIOFileSystemPackageVersion)" />
<PackageReference Include="System.Xml.XPath.XDocument" Version="$(SystemXmlXPathXDocumentPackageVersion)" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'net462' ">
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="$(MicrosoftExtensionsFileProvidersEmbeddedPackageVersionCore31)" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net5.0' ">
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="$(MicrosoftExtensionsFileProvidersEmbeddedPackageVersionNet5)" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="$(MicrosoftExtensionsFileProvidersEmbeddedPackageVersionNet6)" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp2.1;net461</TargetFrameworks>
<TargetFrameworks>net462;net6.0</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/NSwag.AssemblyLoader/AppDomainIsolation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace NSwag.AssemblyLoader
public sealed class AppDomainIsolation<T> : IDisposable where T : AssemblyLoader
{
/// <exception cref="ArgumentNullException"><paramref name="assemblyDirectory"/> is <see langword="null" />.</exception>
public AppDomainIsolation(string assemblyDirectory, string assemblyConfiguration, IEnumerable<BindingRedirect> bindingRedirects, IEnumerable<string> preloadedAssemblies)
public AppDomainIsolation(string assemblyDirectory, string assemblyConfiguration, IEnumerable<BindingRedirect> bindingRedirects, IEnumerable<Assembly> preloadedAssemblies)
{
if (string.IsNullOrEmpty(assemblyDirectory))
{
Expand All @@ -40,7 +40,7 @@ public AppDomainIsolation(string assemblyDirectory, string assemblyConfiguration

foreach (var pa in preloadedAssemblies)
{
Domain.Load(new AssemblyName { CodeBase = pa });
Domain.Load(new AssemblyName { CodeBase = pa.EscapedCodeBase });
}

var type = typeof(T);
Expand Down Expand Up @@ -70,7 +70,7 @@ public void Dispose()

#else

public sealed class AppDomainIsolation<T> : IDisposable where T : AssemblyLoader, new()
public sealed class AppDomainIsolation<T> : IDisposable where T : AssemblyLoader, new()
{
/// <exception cref="ArgumentNullException"><paramref name="assemblyDirectory"/> is <see langword="null" />.</exception>
public AppDomainIsolation(string assemblyDirectory, string assemblyConfiguration, IEnumerable<BindingRedirect> bindingRedirects, IEnumerable<Assembly> preloadedAssemblies)
Expand Down
2 changes: 1 addition & 1 deletion src/NSwag.AssemblyLoader/NSwag.AssemblyLoader.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard1.6;net461;netstandard2.0</TargetFrameworks>
<TargetFrameworks>netstandard1.6;net462;netstandard2.0</TargetFrameworks>
<!-- Missing XML comments -->
<NoWarn>$(NoWarn),1591</NoWarn>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#if NETFRAMEWORK
using System.Web.Mvc;
using System.Web.Http;
#else
using Microsoft.AspNetCore.Mvc;
#endif
using NSwag.CodeGeneration.OperationNameGenerators;
using NSwag.Generation.WebApi;
using System.ComponentModel.DataAnnotations;
Expand Down Expand Up @@ -102,13 +107,13 @@ private static async Task<CSharpClientGenerator> GenerateCode(bool allowNullable

public class TestController : Controller
{
[Route("Foo")]
[Microsoft.AspNetCore.Mvc.Route("Foo")]
public string Foo([FromBody][Required] T requiredBody)
{
return string.Empty;
}

[Route("Bar")]
[Microsoft.AspNetCore.Mvc.Route("Bar")]
public void Bar([FromBody] T notRequiredBody)
{
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
using System.Threading.Tasks;
#if NETFRAMEWORK
using System.Web.Mvc;
#else
using Microsoft.AspNetCore.Mvc;
#endif
using System.Threading.Tasks;
using NSwag.Generation.WebApi;
using Xunit;

Expand Down
10 changes: 7 additions & 3 deletions src/NSwag.CodeGeneration.CSharp.Tests/FileDownloadTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
using System;
#if NETFRAMEWORK
using System.Web.Mvc;
#else
using Microsoft.AspNetCore.Mvc;
#endif
using System;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using NSwag.Generation.WebApi;
using Xunit;

Expand All @@ -11,7 +15,7 @@ public class FileDownloadTests
{
public class FileDownloadController : Controller
{
[Route("DownloadFile")]
[Microsoft.AspNetCore.Mvc.Route("DownloadFile")]
public HttpResponseMessage DownloadFile()
{
throw new NotImplementedException();
Expand Down
10 changes: 7 additions & 3 deletions src/NSwag.CodeGeneration.CSharp.Tests/FileTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
using System;
#if NETFRAMEWORK
using System.Web.Mvc;
#else
using Microsoft.AspNetCore.Mvc;
#endif
using System;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using NSwag.Generation.WebApi;
using Xunit;

Expand All @@ -11,7 +15,7 @@ public class FileTests
{
public class FileDownloadController : Controller
{
[Route("DownloadFile")]
[Microsoft.AspNetCore.Mvc.Route("DownloadFile")]
public HttpResponseMessage DownloadFile()
{
throw new NotImplementedException();
Expand Down
7 changes: 6 additions & 1 deletion src/NSwag.CodeGeneration.CSharp.Tests/FormParameterTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
using System.Threading.Tasks;
#if NETFRAMEWORK
using System.Web.Mvc;
using System.Web.Http;
#else
using Microsoft.AspNetCore.Mvc;
#endif
using System.Threading.Tasks;
using NJsonSchema;
using NSwag.Generation.WebApi;
using Xunit;
Expand Down
6 changes: 5 additions & 1 deletion src/NSwag.CodeGeneration.CSharp.Tests/HeadRequestTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
using System.Threading.Tasks;
#if NETFRAMEWORK
using System.Web.Mvc;
#else
using Microsoft.AspNetCore.Mvc;
#endif
using System.Threading.Tasks;
using NSwag.Generation.WebApi;
using Xunit;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFrameworks>net462;net6.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" />
<PackageReference Include="System.ComponentModel.Annotations" Version="6.0.0-preview.4.21253.7" />
<PackageReference Include="Microsoft.AspNet.Mvc" Version="5.2.3" />
</ItemGroup>

<ItemGroup>
Expand All @@ -16,4 +17,11 @@
<ProjectReference Include="..\NSwag.Generation.WebApi\NSwag.Generation.WebApi.csproj" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' != 'net462'">
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<ProjectReference Include="..\NSwag.Generation.WebApi.Tests\NSwag.Generation.WebApi.Tests.csproj" />
</ItemGroup>
</Project>
14 changes: 9 additions & 5 deletions src/NSwag.CodeGeneration.CSharp.Tests/OptionalParameterTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
using System;
#if NETFRAMEWORK
using System.Web.Mvc;
#else
using Microsoft.AspNetCore.Mvc;
#endif
using System;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using NSwag.Generation.WebApi;
using Xunit;

Expand All @@ -11,17 +15,17 @@ public class OptionalParameterTests
{
public class TestController : Controller
{
[Route("Test")]
[Microsoft.AspNetCore.Mvc.Route("Test")]
public void Test(string a, string b, string c = null)
{
}

[Route("TestWithClass")]
[Microsoft.AspNetCore.Mvc.Route("TestWithClass")]
public void TestWithClass([FromUri] MyClass objet)
{
}

[Route("TestWithEnum")]
[Microsoft.AspNetCore.Mvc.Route("TestWithEnum")]
public void TestWithEnum([FromUri] MyEnum? myEnum = null)
{
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"profiles": {
"NSwag.CodeGeneration.CSharp.Tests": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:52040"
}
}
}
Loading