Remove net451 as a cross-compile target

This commit is contained in:
Pranav K 2017-03-12 16:02:09 -07:00
parent d5cbdb8ac6
commit 31a2bdffce
20 changed files with 47 additions and 56 deletions

1
.gitignore vendored
View File

@ -29,3 +29,4 @@ project.lock.json
.vscode/ .vscode/
.build/ .build/
.testPublish/ .testPublish/
global.json

View File

@ -3,7 +3,7 @@
<Import Project="..\..\build\dependencies.props" /> <Import Project="..\..\build\dependencies.props" />
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net451;netcoreapp2.0</TargetFrameworks> <TargetFrameworks>net46;netcoreapp2.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -4,7 +4,7 @@
<PropertyGroup> <PropertyGroup>
<Description>ASP.NET Core hosting and startup abstractions for web applications.</Description> <Description>ASP.NET Core hosting and startup abstractions for web applications.</Description>
<TargetFrameworks>net451;netstandard1.3</TargetFrameworks> <TargetFramework>netstandard1.3</TargetFramework>
<NoWarn>$(NoWarn);CS1591</NoWarn> <NoWarn>$(NoWarn);CS1591</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore;hosting</PackageTags> <PackageTags>aspnetcore;hosting</PackageTags>

View File

@ -4,7 +4,7 @@
<PropertyGroup> <PropertyGroup>
<Description>ASP.NET Core hosting server abstractions for web applications.</Description> <Description>ASP.NET Core hosting server abstractions for web applications.</Description>
<TargetFrameworks>net451;netstandard1.3</TargetFrameworks> <TargetFramework>netstandard1.3</TargetFramework>
<NoWarn>$(NoWarn);CS1591</NoWarn> <NoWarn>$(NoWarn);CS1591</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore;hosting</PackageTags> <PackageTags>aspnetcore;hosting</PackageTags>

View File

@ -4,7 +4,7 @@
<PropertyGroup> <PropertyGroup>
<Description>ASP.NET Core hosting infrastructure and startup logic for web applications running within a Windows service.</Description> <Description>ASP.NET Core hosting infrastructure and startup logic for web applications running within a Windows service.</Description>
<TargetFramework>net451</TargetFramework> <TargetFramework>net46</TargetFramework>
<NoWarn>$(NoWarn);CS1591</NoWarn> <NoWarn>$(NoWarn);CS1591</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore;hosting</PackageTags> <PackageTags>aspnetcore;hosting</PackageTags>

View File

@ -207,8 +207,10 @@ namespace Microsoft.AspNetCore.Hosting.Internal
var systemRuntimeAssembly = typeof(System.ComponentModel.DefaultValueAttribute).GetTypeInfo().Assembly; var systemRuntimeAssembly = typeof(System.ComponentModel.DefaultValueAttribute).GetTypeInfo().Assembly;
var assemblyVersion = new AssemblyName(systemRuntimeAssembly.FullName).Version.ToString(); var assemblyVersion = new AssemblyName(systemRuntimeAssembly.FullName).Version.ToString();
var clrVersion = assemblyVersion; var clrVersion = assemblyVersion;
#else #elif NET46
var clrVersion = Environment.Version.ToString(); var clrVersion = Environment.Version.ToString();
#else
#error Target frameworks need to be updated.
#endif #endif
model.RuntimeArchitecture = RuntimeInformation.ProcessArchitecture.ToString(); model.RuntimeArchitecture = RuntimeInformation.ProcessArchitecture.ToString();
var currentAssembly = typeof(ErrorPage).GetTypeInfo().Assembly; var currentAssembly = typeof(ErrorPage).GetTypeInfo().Assembly;

View File

@ -4,7 +4,7 @@
<PropertyGroup> <PropertyGroup>
<Description>ASP.NET Core hosting infrastructure and startup logic for web applications.</Description> <Description>ASP.NET Core hosting infrastructure and startup logic for web applications.</Description>
<TargetFrameworks>net451;netstandard1.3;netstandard1.5</TargetFrameworks> <TargetFrameworks>netstandard1.3;netstandard1.5</TargetFrameworks>
<NoWarn>$(NoWarn);CS1591</NoWarn> <NoWarn>$(NoWarn);CS1591</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore;hosting</PackageTags> <PackageTags>aspnetcore;hosting</PackageTags>
@ -31,11 +31,8 @@
<PackageReference Include="Microsoft.Extensions.StackTrace.Sources" Version="$(AspNetCoreVersion)" PrivateAssets="All"/> <PackageReference Include="Microsoft.Extensions.StackTrace.Sources" Version="$(AspNetCoreVersion)" PrivateAssets="All"/>
<PackageReference Include="Microsoft.Extensions.TypeNameHelper.Sources" Version="$(AspNetCoreVersion)" PrivateAssets="All"/> <PackageReference Include="Microsoft.Extensions.TypeNameHelper.Sources" Version="$(AspNetCoreVersion)" PrivateAssets="All"/>
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="$(CoreFxVersion)" /> <PackageReference Include="System.Diagnostics.DiagnosticSource" Version="$(CoreFxVersion)" />
<PackageReference Include="System.Reflection.Metadata" Version="$(SystemReflectionMetadataVersion)" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'net451'">
<PackageReference Include="System.Diagnostics.StackTrace" Version="$(CoreFxVersion)" /> <PackageReference Include="System.Diagnostics.StackTrace" Version="$(CoreFxVersion)" />
<PackageReference Include="System.Reflection.Metadata" Version="$(SystemReflectionMetadataVersion)" />
</ItemGroup> </ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.5' "> <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.5' ">

View File

@ -37,6 +37,9 @@ namespace Microsoft.AspNetCore.Hosting
#if NETSTANDARD1_5 #if NETSTANDARD1_5
var assemblyLoadContext = AssemblyLoadContext.GetLoadContext(typeof(WebHostExtensions).GetTypeInfo().Assembly); var assemblyLoadContext = AssemblyLoadContext.GetLoadContext(typeof(WebHostExtensions).GetTypeInfo().Assembly);
assemblyLoadContext.Unloading += context => shutdown(); assemblyLoadContext.Unloading += context => shutdown();
#elif NETSTANDARD1_3
#else
#error Target frameworks need to be updated.
#endif #endif
Console.CancelKeyPress += (sender, eventArgs) => Console.CancelKeyPress += (sender, eventArgs) =>
{ {

View File

@ -57,8 +57,11 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting
else else
{ {
if (exception is HttpRequestException if (exception is HttpRequestException
#if NET452 #if NET46
|| exception is System.Net.WebException || exception is System.Net.WebException
#elif NETSTANDARD1_3
#else
#error Target frameworks need to be updated.
#endif #endif
) )
{ {

View File

@ -125,13 +125,7 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting
protected void AddEnvironmentVariablesToProcess(ProcessStartInfo startInfo, List<KeyValuePair<string, string>> environmentVariables) protected void AddEnvironmentVariablesToProcess(ProcessStartInfo startInfo, List<KeyValuePair<string, string>> environmentVariables)
{ {
var environment = var environment = startInfo.Environment;
#if NET452
startInfo.EnvironmentVariables;
#else
startInfo.Environment;
#endif
SetEnvironmentVariable(environment, "ASPNETCORE_ENVIRONMENT", DeploymentParameters.EnvironmentName); SetEnvironmentVariable(environment, "ASPNETCORE_ENVIRONMENT", DeploymentParameters.EnvironmentName);
foreach (var environmentVariable in environmentVariables) foreach (var environmentVariable in environmentVariables)
@ -140,13 +134,8 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting
} }
} }
#if NET452 protected void SetEnvironmentVariable(IDictionary<string, string> environment, string name, string value)
protected void SetEnvironmentVariable(System.Collections.Specialized.StringDictionary environment, string name, string value)
{ {
#else
protected void SetEnvironmentVariable(System.Collections.Generic.IDictionary<string, string> environment, string name, string value)
{
#endif
if (value == null) if (value == null)
{ {
Logger.LogInformation("Removing environment variable {name}", name); Logger.LogInformation("Removing environment variable {name}", name);

View File

@ -33,9 +33,12 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting
{ {
case ServerType.IISExpress: case ServerType.IISExpress:
return new IISExpressDeployer(deploymentParameters, logger); return new IISExpressDeployer(deploymentParameters, logger);
#if NET452 #if NET46
case ServerType.IIS: case ServerType.IIS:
return new IISDeployer(deploymentParameters, logger); return new IISDeployer(deploymentParameters, logger);
#elif NETSTANDARD1_3
#else
#error Target framework needs to be updated.
#endif #endif
case ServerType.WebListener: case ServerType.WebListener:
case ServerType.Kestrel: case ServerType.Kestrel:

View File

@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved. // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#if NET452 #if NET46
using System; using System;
using System.Linq; using System.Linq;
@ -148,5 +148,7 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting
} }
} }
} }
#elif NETSTANDARD1_3
#else
#error Target framework needs to be updated.
#endif #endif

View File

@ -77,7 +77,7 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting
else else
{ {
workingDirectory = DeploymentParameters.ApplicationPath; workingDirectory = DeploymentParameters.ApplicationPath;
var targetFramework = DeploymentParameters.TargetFramework ?? (DeploymentParameters.RuntimeFlavor == RuntimeFlavor.Clr ? "net451" : "netcoreapp1.1"); var targetFramework = DeploymentParameters.TargetFramework ?? (DeploymentParameters.RuntimeFlavor == RuntimeFlavor.Clr ? "net46" : "netcoreapp2.0");
executableName = DotnetCommandName; executableName = DotnetCommandName;
executableArgs = $"run --framework {targetFramework} {DotnetArgumentSeparator}"; executableArgs = $"run --framework {targetFramework} {DotnetArgumentSeparator}";

View File

@ -5,11 +5,10 @@
<PropertyGroup> <PropertyGroup>
<Description>ASP.NET Core helpers to deploy applications to IIS Express, IIS, WebListener and Kestrel for testing.</Description> <Description>ASP.NET Core helpers to deploy applications to IIS Express, IIS, WebListener and Kestrel for testing.</Description>
<VersionPrefix>0.3.0</VersionPrefix> <VersionPrefix>0.3.0</VersionPrefix>
<TargetFrameworks>net452;netstandard1.3</TargetFrameworks> <TargetFrameworks>net46;netstandard1.3</TargetFrameworks>
<NoWarn>$(NoWarn);CS1591</NoWarn> <NoWarn>$(NoWarn);CS1591</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore;testing</PackageTags> <PackageTags>aspnetcore;testing</PackageTags>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.3' ">$(PackageTargetFallback);portable-net45+win8</PackageTargetFallback>
<EnableApiCheck>false</EnableApiCheck> <EnableApiCheck>false</EnableApiCheck>
</PropertyGroup> </PropertyGroup>
@ -27,7 +26,7 @@
<PackageReference Include="Microsoft.NETCore.Windows.ApiSets" Version="$(WindowsApiSetsVersion)" /> <PackageReference Include="Microsoft.NETCore.Windows.ApiSets" Version="$(WindowsApiSetsVersion)" />
</ItemGroup> </ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net452' "> <ItemGroup Condition=" '$(TargetFramework)' == 'net46' ">
<PackageReference Include="Microsoft.Web.Administration" Version="$(WebAdministrationVersion)" /> <PackageReference Include="Microsoft.Web.Administration" Version="$(WebAdministrationVersion)" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />

View File

@ -4,7 +4,7 @@
<PropertyGroup> <PropertyGroup>
<Description>ASP.NET Core web server for writing and running tests.</Description> <Description>ASP.NET Core web server for writing and running tests.</Description>
<TargetFrameworks>net451;netstandard1.3</TargetFrameworks> <TargetFrameworks>netstandard1.3;net46</TargetFrameworks>
<NoWarn>$(NoWarn);CS1591</NoWarn> <NoWarn>$(NoWarn);CS1591</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore;hosting;testing</PackageTags> <PackageTags>aspnetcore;hosting;testing</PackageTags>

View File

@ -168,20 +168,7 @@ namespace Microsoft.AspNetCore.TestHost
_readLock.Release(); _readLock.Release();
} }
} }
#if NET451
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
{
// TODO: This option doesn't preserve the state object.
// return ReadAsync(buffer, offset, count);
return base.BeginRead(buffer, offset, count, callback, state);
}
public override int EndRead(IAsyncResult asyncResult)
{
// return ((Task<int>)asyncResult).Result;
return base.EndRead(asyncResult);
}
#endif
public async override Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) public async override Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{ {
VerifyBuffer(buffer, offset, count, allowEmpty: false); VerifyBuffer(buffer, offset, count, allowEmpty: false);
@ -266,7 +253,8 @@ namespace Microsoft.AspNetCore.TestHost
_writeLock.Release(); _writeLock.Release();
} }
} }
#if NET451
#if NET46
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state) public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
{ {
Write(buffer, offset, count); Write(buffer, offset, count);
@ -283,7 +271,11 @@ namespace Microsoft.AspNetCore.TestHost
public override void EndWrite(IAsyncResult asyncResult) public override void EndWrite(IAsyncResult asyncResult)
{ {
} }
#elif NETSTANDARD1_3
#else
#error Target frameworks need to be updated.
#endif #endif
public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{ {
VerifyBuffer(buffer, offset, count, allowEmpty: true); VerifyBuffer(buffer, offset, count, allowEmpty: true);

View File

@ -3,7 +3,7 @@
<Import Project="..\..\build\common.props" /> <Import Project="..\..\build\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net452</TargetFrameworks> <TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks> <TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>

View File

@ -45,7 +45,7 @@ namespace Microsoft.AspNetCore.Hosting.Internal
Assert.Equal(expectedEventId, eventData.EventId); Assert.Equal(expectedEventId, eventData.EventId);
#if NETCOREAPP2_0 #if NETCOREAPP2_0
Assert.Equal("HostStart", eventData.EventName); Assert.Equal("HostStart", eventData.EventName);
#elif NET452 #elif NET46
#else #else
#error Target framework needs to be updated #error Target framework needs to be updated
#endif #endif
@ -73,7 +73,7 @@ namespace Microsoft.AspNetCore.Hosting.Internal
Assert.Equal(expectedEventId, eventData.EventId); Assert.Equal(expectedEventId, eventData.EventId);
#if NETCOREAPP2_0 #if NETCOREAPP2_0
Assert.Equal("HostStop", eventData.EventName); Assert.Equal("HostStop", eventData.EventName);
#elif NET452 #elif NET46
#else #else
#error Target framework needs to be updated #error Target framework needs to be updated
#endif #endif
@ -134,7 +134,7 @@ namespace Microsoft.AspNetCore.Hosting.Internal
Assert.Equal(expectedEventId, eventData.EventId); Assert.Equal(expectedEventId, eventData.EventId);
#if NETCOREAPP2_0 #if NETCOREAPP2_0
Assert.Equal("RequestStart", eventData.EventName); Assert.Equal("RequestStart", eventData.EventName);
#elif NET452 #elif NET46
#else #else
#error Target framework needs to be updated #error Target framework needs to be updated
#endif #endif
@ -167,7 +167,7 @@ namespace Microsoft.AspNetCore.Hosting.Internal
Assert.Equal(expectedEventId, eventData.EventId); Assert.Equal(expectedEventId, eventData.EventId);
#if NETCOREAPP2_0 #if NETCOREAPP2_0
Assert.Equal("RequestStop", eventData.EventName); Assert.Equal("RequestStop", eventData.EventName);
#elif NET452 #elif NET46
#else #else
#error Target framework needs to be updated #error Target framework needs to be updated
#endif #endif
@ -194,7 +194,7 @@ namespace Microsoft.AspNetCore.Hosting.Internal
Assert.Equal(expectedEventId, eventData.EventId); Assert.Equal(expectedEventId, eventData.EventId);
#if NETCOREAPP2_0 #if NETCOREAPP2_0
Assert.Equal("UnhandledException", eventData.EventName); Assert.Equal("UnhandledException", eventData.EventName);
#elif NET452 #elif NET46
#else #else
#error Target framework needs to be updated #error Target framework needs to be updated
#endif #endif

View File

@ -3,7 +3,7 @@
<Import Project="..\..\build\common.props" /> <Import Project="..\..\build\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net452</TargetFrameworks> <TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks> <TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>

View File

@ -3,7 +3,7 @@
<Import Project="..\..\build\common.props" /> <Import Project="..\..\build\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net452</TargetFrameworks> <TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks> <TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>