Change compilation targets.

* Remove net451 as a compilation target
* Upgrade to netcoreapp2.0
This commit is contained in:
Pranav K 2017-03-21 14:42:11 -07:00
parent b79446ce51
commit 52911cd3f1
9 changed files with 11 additions and 31 deletions

1
.gitignore vendored
View File

@ -28,3 +28,4 @@ nuget.exe
.build/ .build/
autobahnreports/ autobahnreports/
.vscode/ .vscode/
global.json

View File

@ -5,6 +5,7 @@
<AspNetCoreModuleVersion>1.0.0-*</AspNetCoreModuleVersion> <AspNetCoreModuleVersion>1.0.0-*</AspNetCoreModuleVersion>
<CoreFxVersion>4.3.0</CoreFxVersion> <CoreFxVersion>4.3.0</CoreFxVersion>
<NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion> <NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion>
<RuntimeFrameworkVersion>2.0.0-*</RuntimeFrameworkVersion>
<TestSdkVersion>15.0.0</TestSdkVersion> <TestSdkVersion>15.0.0</TestSdkVersion>
<XunitVersion>2.2.0</XunitVersion> <XunitVersion>2.2.0</XunitVersion>
</PropertyGroup> </PropertyGroup>

View File

@ -3,7 +3,7 @@
<Import Project="..\..\build\dependencies.props" /> <Import Project="..\..\build\dependencies.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework> <TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -16,31 +16,17 @@ namespace System.Net.WebSockets
public static Task FromException(Exception ex) public static Task FromException(Exception ex)
{ {
#if NET451
return FromException<object>(ex);
#else
return Task.FromException(ex); return Task.FromException(ex);
#endif
} }
public static Task<T> FromException<T>(Exception ex) public static Task<T> FromException<T>(Exception ex)
{ {
#if NET451
var tcs = new TaskCompletionSource<T>();
tcs.SetException(ex);
return tcs.Task;
#else
return Task.FromException<T>(ex); return Task.FromException<T>(ex);
#endif
} }
internal static T[] Empty<T>() internal static T[] Empty<T>()
{ {
#if NET451
return new T[0];
#else
return Array.Empty<T>(); return Array.Empty<T>();
#endif
} }
} }

View File

@ -4,7 +4,7 @@
<PropertyGroup> <PropertyGroup>
<Description>ASP.NET Core web socket middleware for use on top of opaque servers.</Description> <Description>ASP.NET Core web socket middleware for use on top of opaque servers.</Description>
<TargetFrameworks>net451;netstandard1.3</TargetFrameworks> <TargetFramework>netstandard1.3</TargetFramework>
<NoWarn>$(NoWarn);CS1591</NoWarn> <NoWarn>$(NoWarn);CS1591</NoWarn>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>

View File

@ -3,7 +3,7 @@
<Import Project="..\..\build\common.props" /> <Import Project="..\..\build\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework> <TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -100,7 +100,7 @@ namespace Microsoft.AspNetCore.WebSockets.ConformanceTest.Autobahn
{ {
ApplicationBaseUriHint = baseUrl, ApplicationBaseUriHint = baseUrl,
ApplicationType = ApplicationType.Portable, ApplicationType = ApplicationType.Portable,
TargetFramework = "netcoreapp1.1", TargetFramework = "netcoreapp2.0",
EnvironmentName = environment, EnvironmentName = environment,
SiteName = "HttpTestSite", // This is configured in the Http.config SiteName = "HttpTestSite", // This is configured in the Http.config
ServerConfigTemplateContent = (server == ServerType.IISExpress) ? File.ReadAllText(configPath) : null, ServerConfigTemplateContent = (server == ServerType.IISExpress) ? File.ReadAllText(configPath) : null,
@ -111,10 +111,6 @@ namespace Microsoft.AspNetCore.WebSockets.ConformanceTest.Autobahn
_deployers.Add(deployer); _deployers.Add(deployer);
cancellationToken.ThrowIfCancellationRequested(); cancellationToken.ThrowIfCancellationRequested();
#if NET451
System.Net.ServicePointManager.ServerCertificateValidationCallback = (_, __, ___, ____) => true;
var client = new HttpClient();
#else
var handler = new HttpClientHandler(); var handler = new HttpClientHandler();
if (ssl) if (ssl)
{ {
@ -124,7 +120,6 @@ namespace Microsoft.AspNetCore.WebSockets.ConformanceTest.Autobahn
handler.ServerCertificateCustomValidationCallback = (_, __, ___, ____) => true; handler.ServerCertificateCustomValidationCallback = (_, __, ___, ____) => true;
} }
var client = new HttpClient(handler); var client = new HttpClient(handler);
#endif
// Make sure the server works // Make sure the server works
var resp = await RetryHelper.RetryRequest(() => var resp = await RetryHelper.RetryRequest(() =>

View File

@ -3,7 +3,7 @@
<Import Project="..\..\build\common.props" /> <Import Project="..\..\build\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework> <TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -3,9 +3,9 @@
<Import Project="..\..\build\common.props" /> <Import Project="..\..\build\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net452;netcoreapp1.1</TargetFrameworks> <TargetFrameworks>net46;netcoreapp2.0</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">netcoreapp1.1</TargetFrameworks> <TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">netcoreapp2.0</TargetFrameworks>
<PlatformTarget Condition="'$(TargetFramework)' == 'net452'">x64</PlatformTarget> <PlatformTarget Condition="'$(TargetFramework)' == 'net46'">x64</PlatformTarget>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -16,12 +16,9 @@
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="$(AspNetCoreVersion)" /> <PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Testing" Version="$(AspNetCoreVersion)" /> <PackageReference Include="Microsoft.AspNetCore.Testing" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(TestSdkVersion)" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(TestSdkVersion)" />
<PackageReference Include="System.Net.WebSockets.Client" Version="$(CoreFxVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" /> <PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
<PackageReference Include="xunit" Version="$(XunitVersion)" /> <PackageReference Include="xunit" Version="$(XunitVersion)" />
</ItemGroup> </ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.1' ">
<PackageReference Include="System.Net.WebSockets.Client" Version="$(CoreFxVersion)" />
</ItemGroup>
</Project> </Project>