Skip to content
Permalink
Browse files

Align with new Microsoft.Extensions.ApiDescription.Client package (#2148

)

- aspnet/AspNetCore#8487
- NSwag.ApiDescription.Design -> NSwag.ApiDescription.Client
  - match newer Microsoft package and clear way for an NSwag.ApiDescription.Server package
- `@(CurrentServiceFileReference)` -> `@(CurrentOpenApiReference)`
- remove `@(ServiceProjectReference)` support; coming in NSwag.ApiDescription.Server package
- use `%(Options)` metadata instead of `%(GenerateNSwagCSharpOptions)` and `%(GenerateNSwagTypeScriptOptions)`
- use `%(FirstForGenerator)` metadata to avoid (some) compilation errors due to duplicate class definitions
- use supported (LTS) runtime when executing `dotnet-nswag.dll`
  • Loading branch information...
dougbu authored and RicoSuter committed May 6, 2019
1 parent 66b0e0d commit 4439cf2ec6aa7cf2d971ff52c8b19330e404285e
@@ -26,7 +26,7 @@ xcopy "%~dp0/../src/NSwag.ConsoleCore/bin/release/netcoreapp2.2/publish" "%~dp0/

REM Package nuspecs
"%~dp0/nuget.exe" pack "%~dp0/../src/NSwag.MSBuild/NSwag.MSBuild.nuspec" || goto :error
"%~dp0/nuget.exe" pack "%~dp0/../src/NSwag.ApiDescription.Design/NSwag.ApiDescription.Design.nuspec" || goto :error
"%~dp0/nuget.exe" pack "%~dp0/../src/NSwag.ApiDescription.Client/NSwag.ApiDescription.Client.nuspec" || goto :error
"%~dp0/nuget.exe" pack "%~dp0/../src/NSwagStudio.Chocolatey/NSwagStudio.nuspec" || goto :error

goto :EOF
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>NSwag.ApiDescription.Design</id>
<id>NSwag.ApiDescription.Client</id>
<version>12.2.5</version>
<authors>Rico Suter</authors>
<owners>Rico Suter</owners>
@@ -14,12 +14,12 @@
<copyright>Copyright © Rico Suter, 2019</copyright>
<developmentDependency>true</developmentDependency>
<dependencies>
<dependency id="Microsoft.Extensions.ApiDescription.Design" version="0.1.0-preview1-10773" />
<dependency id="Microsoft.Extensions.ApiDescription.Client" version="0.3.0-preview5-19227-01" />
<dependency id="NSwag.MSBuild" version="12.0.0" />
</dependencies>
<references />
</metadata>
<files>
<file src="NSwag.ApiDescription.Design.targets" target="build" />
<file src="NSwag.ApiDescription.Client.targets" target="build" />
</files>
</package>
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project>
<PropertyGroup>
<_NSwagCommand>$(NSwagExe)</_NSwagCommand>
<_NSwagCommand Condition="'$(MSBuildRuntimeType)' == 'Core'">$(NSwagExe_Core21)</_NSwagCommand>
</PropertyGroup>

<!-- OpenApiReference support for C# -->

<Target Name="GenerateNSwagCSharp">
<ItemGroup>
<!-- @(CurrentOpenApiReference) item group will never contain more than one item. -->
<CurrentOpenApiReference>
<Command>$(_NSwagCommand) swagger2csclient /className:%(ClassName) /namespace:%(Namespace)</Command>
</CurrentOpenApiReference>
<CurrentOpenApiReference>
<Command>%(Command) /input:%(FullPath) /output:%(OutputPath) %(Options)</Command>
</CurrentOpenApiReference>
<CurrentOpenApiReference>
<Command Condition="! %(FirstForGenerator)">%(Command) /GenerateExceptionClasses:false</Command>
</CurrentOpenApiReference>
</ItemGroup>

<Message Importance="high" Text="%0AGenerateNSwagCSharp:" />
<Message Importance="high" Text=" %(CurrentOpenApiReference.Command)" />
<Exec Command="%(CurrentOpenApiReference.Command)" IgnoreExitCode="$([System.IO.File]::Exists('%(OutputPath)'))" />
</Target>

<!-- OpenApiReference support for TypeScript -->

<Target Name="GenerateNSwagTypeScript">
<ItemGroup>
<!-- @(CurrentOpenApiReference) item group will never contain more than one item. -->
<CurrentOpenApiReference>
<Command>$(_NSwagCommand) swagger2tsclient /className:%(ClassName) /namespace:%(Namespace)</Command>
</CurrentOpenApiReference>
<CurrentOpenApiReference>
<Command>%(Command) /input:%(FullPath) /output:%(OutputPath) %(Options)</Command>
</CurrentOpenApiReference>
</ItemGroup>

<Message Importance="high" Text="%0AGenerateNSwagTypeScript:" />
<Message Importance="high" Text=" %(CurrentOpenApiReference.Command)" />
<Exec Command="%(CurrentOpenApiReference.Command)" IgnoreExitCode="$([System.IO.File]::Exists('%(OutputPath)'))" />
</Target>
</Project>

This file was deleted.

@@ -154,10 +154,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSwag.SwaggerGeneration.Asp
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSwag.AssemblyLoader.Tests", "NSwag.AssemblyLoader.Tests\NSwag.AssemblyLoader.Tests.csproj", "{1853262B-6D39-477B-872A-8B5473FE74BB}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NSwag.ApiDescription.Design", "NSwag.ApiDescription.Design", "{E6E40935-0C79-480B-BF29-8C493AC7E518}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NSwag.ApiDescription.Client", "NSwag.ApiDescription.Client", "{E6E40935-0C79-480B-BF29-8C493AC7E518}"
ProjectSection(SolutionItems) = preProject
NSwag.ApiDescription.Design\NSwag.ApiDescription.Design.nuspec = NSwag.ApiDescription.Design\NSwag.ApiDescription.Design.nuspec
NSwag.ApiDescription.Design\NSwag.ApiDescription.Design.targets = NSwag.ApiDescription.Design\NSwag.ApiDescription.Design.targets
NSwag.ApiDescription.Client\NSwag.ApiDescription.Client.nuspec = NSwag.ApiDescription.Client\NSwag.ApiDescription.Client.nuspec
NSwag.ApiDescription.Client\NSwag.ApiDescription.Client.targets = NSwag.ApiDescription.Client\NSwag.ApiDescription.Client.targets
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NSwag.Sample.NETCore22", "NSwag.Sample.NETCore22\NSwag.Sample.NETCore22.csproj", "{AC8C4C44-C9AA-4894-AF21-868B53A96429}"

0 comments on commit 4439cf2

Please sign in to comment.
You can’t perform that action at this time.