Permalink
Browse files

Add support for .NET Core 2.0 (#888)

  • Loading branch information...
RSuter committed Aug 16, 2017
1 parent 95e71b5 commit f41686d3259cf772934cadb14e48b328cbd4cfbd
View
@@ -15,6 +15,8 @@ dotnet restore "%~dp0/../src/NSwag.ConsoleCore" --no-cache
dotnet build "%~dp0/../src/NSwag.ConsoleCore"
dotnet publish "%~dp0/../src/NSwag.ConsoleCore" -c release -f "netcoreapp1.0"
dotnet publish "%~dp0/../src/NSwag.ConsoleCore" -c release -f "netcoreapp1.1"
dotnet publish "%~dp0/../src/NSwag.ConsoleCore" -c release -f "netcoreapp2.0"
xcopy "%~dp0/../src/NSwag.ConsoleCore/bin/release/netcoreapp1.0/publish" "%~dp0/../src/NSwag.Npm/bin/binaries/netcoreapp1.0" /E /I /y
xcopy "%~dp0/../src/NSwag.ConsoleCore/bin/release/netcoreapp1.1/publish" "%~dp0/../src/NSwag.Npm/bin/binaries/netcoreapp1.1" /E /I /y
xcopy "%~dp0/../src/NSwag.ConsoleCore/bin/release/netcoreapp1.1/publish" "%~dp0/../src/NSwag.Npm/bin/binaries/netcoreapp1.1" /E /I /y
xcopy "%~dp0/../src/NSwag.ConsoleCore/bin/release/netcoreapp2.0/publish" "%~dp0/../src/NSwag.Npm/bin/binaries/netcoreapp2.0" /E /I /y
View
@@ -1,6 +1,6 @@
{
"projects": [],
"sdk": {
"version": "1.0.0"
}
"projects": [],
"sdk": {
"version": "2.0.0"
}
}
@@ -29,7 +29,7 @@
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
<PackageReference Include="System.IO.FileSystem" Version="4.0.1" />
<PackageReference Include="System.IO.FileSystem" Version="4.3.0" />
<PackageReference Include="System.Xml.XPath.XDocument" Version="4.0.1" />
</ItemGroup>
<ItemGroup>
@@ -19,11 +19,11 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NJsonSchema" Version="9.4.5" />
<PackageReference Include="System.Net.Http" Version="4.1.1" />
<PackageReference Include="System.Net.Http" Version="4.3.2" />
<PackageReference Include="System.Runtime.Loader" Version="4.0.0" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
<PackageReference Include="System.IO.FileSystem" Version="4.0.1" />
<PackageReference Include="System.IO.FileSystem" Version="4.3.0" />
<PackageReference Include="System.Xml.XPath.XDocument" Version="4.0.1" />
</ItemGroup>
<ItemGroup>
@@ -114,8 +114,8 @@
<Reference Include="System.IO.FileSystem.Primitives, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.FileSystem.Primitives.4.3.0\lib\net46\System.IO.FileSystem.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.Http.4.3.0\lib\net46\System.Net.Http.dll</HintPath>
<Reference Include="System.Net.Http, Version=4.1.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.Http.4.3.2\lib\net46\System.Net.Http.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath>
@@ -24,7 +24,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
<bindingRedirect oldVersion="0.0.0.0-4.1.1.1" newVersion="4.1.1.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
@@ -33,7 +33,7 @@
<package id="System.IO.FileSystem.Primitives" version="4.3.0" targetFramework="net46" />
<package id="System.Linq" version="4.3.0" targetFramework="net46" />
<package id="System.Linq.Expressions" version="4.3.0" targetFramework="net46" />
<package id="System.Net.Http" version="4.3.0" targetFramework="net46" />
<package id="System.Net.Http" version="4.3.2" targetFramework="net462" />
<package id="System.Net.Primitives" version="4.3.0" targetFramework="net46" />
<package id="System.Net.Sockets" version="4.3.0" targetFramework="net46" />
<package id="System.ObjectModel" version="4.3.0" targetFramework="net46" />
@@ -79,8 +79,8 @@
<Reference Include="System.IO.FileSystem.Primitives, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.FileSystem.Primitives.4.3.0\lib\net46\System.IO.FileSystem.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.Http.4.3.0\lib\net46\System.Net.Http.dll</HintPath>
<Reference Include="System.Net.Http, Version=4.1.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.Http.4.3.2\lib\net46\System.Net.Http.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath>
@@ -16,7 +16,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
<bindingRedirect oldVersion="0.0.0.0-4.1.1.1" newVersion="4.1.1.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
@@ -27,7 +27,7 @@
<package id="System.IO.FileSystem.Primitives" version="4.3.0" targetFramework="net46" />
<package id="System.Linq" version="4.3.0" targetFramework="net46" />
<package id="System.Linq.Expressions" version="4.3.0" targetFramework="net46" />
<package id="System.Net.Http" version="4.3.0" targetFramework="net46" />
<package id="System.Net.Http" version="4.3.2" targetFramework="net462" />
<package id="System.Net.Primitives" version="4.3.0" targetFramework="net46" />
<package id="System.Net.Sockets" version="4.3.0" targetFramework="net46" />
<package id="System.ObjectModel" version="4.3.0" targetFramework="net46" />
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp1.0;netcoreapp1.1</TargetFrameworks>
<TargetFrameworks>netcoreapp1.0;netcoreapp1.1;netcoreapp2.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<Description>NSwag: The Swagger API toolchain for .NET and TypeScript</Description>
<Version>11.3.5</Version>
@@ -21,7 +21,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="NConsole" Version="3.6.6378.42120" />
<PackageReference Include="System.IO.FileSystem" Version="4.0.1" />
<PackageReference Include="System.Net.Http" Version="4.3.0" />
<PackageReference Include="System.IO.FileSystem" Version="4.3.0" />
<PackageReference Include="System.Net.Http" Version="4.3.2" />
</ItemGroup>
</Project>
View
@@ -21,7 +21,11 @@ if (process.env["windir"]) {
}
var c = require('child_process');
if (hasFullDotNet && args.indexOf("--core") == -1 && args.indexOf("--core 1.0") == -1 && args.indexOf("--core 1.1") == -1) {
if (hasFullDotNet &&
args.indexOf("--core") == -1 &&
args.indexOf("--core 1.0") == -1 &&
args.indexOf("--core 1.1") == -1 &&
args.indexOf("--core 2.0") == -1) {
// Run full .NET version
if (args.indexOf("--x86") != -1) {
var cmd = '"' + __dirname + '/binaries/full/nswag.x86.exe" ' + args;
@@ -34,12 +38,15 @@ if (hasFullDotNet && args.indexOf("--core") == -1 && args.indexOf("--core 1.0")
// Run .NET Core version
var core10cmd = 'dotnet "' + __dirname + '/binaries/netcoreapp1.0/dotnet-nswag.dll" ' + args;
var core11cmd = 'dotnet "' + __dirname + '/binaries/netcoreapp1.1/dotnet-nswag.dll" ' + args;
var core20cmd = 'dotnet "' + __dirname + '/binaries/netcoreapp2.0/dotnet-nswag.dll" ' + args;
var cmd = "dotnet";
if (args.indexOf("--core 1.0") != -1)
c.execSync(core10cmd, { stdio: [0, 1, 2] });
else if (args.indexOf("--core 1.1") != -1)
c.execSync(core11cmd, { stdio: [0, 1, 2] });
else if (args.indexOf("--core 2.0") != -1)
c.execSync(core20cmd, { stdio: [0, 1, 2] });
else {
c.exec(cmd, (error, stdout, stderr) => {
if (!error) {
@@ -48,7 +55,9 @@ if (hasFullDotNet && args.indexOf("--core") == -1 && args.indexOf("--core 1.0")
c.execSync(core10cmd, { stdio: [0, 1, 2] });
else if (dotnetVersion.indexOf("Version : 1.1.0") !== -1)
c.execSync(core11cmd, { stdio: [0, 1, 2] });
} else
else if (dotnetVersion.indexOf("Version : 2.0.0") !== -1)
c.execSync(core20cmd, { stdio: [0, 1, 2] });
} else // default:
c.execSync(core11cmd, { stdio: [0, 1, 2] });
});
}

0 comments on commit f41686d

Please sign in to comment.