Target NETStandard 2.0

This commit is contained in:
John Luo 2017-05-21 23:56:13 -07:00
parent f12fc69cbf
commit d6a653145d
11 changed files with 109 additions and 47 deletions

1
.gitignore vendored
View File

@ -26,6 +26,7 @@ project.lock.json
*.*sdf
*.ipch
*.vs/
.vscode/
.testPublish/
.build/
*.nuget.props

View File

@ -16,8 +16,8 @@
<PackageReference Include="Internal.AspNetCore.Sdk" Version="$(InternalAspNetCoreSdkVersion)" PrivateAssets="All" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFrameworkIdentifier)'=='.NETFramework' AND '$(OutputType)'=='library'">
<PackageReference Include="NETStandard.Library" Version="$(BundledNETStandardPackageVersion)" />
<ItemGroup Condition="'$(TargetFrameworkIdentifier)'=='.NETFramework'">
<PackageReference Include="NETStandard.Library.NETFramework" Version="$(NETStandardLibraryNETFrameworkVersion)" PrivateAssets="All" />
</ItemGroup>
</Project>

View File

@ -3,9 +3,9 @@
<AspNetCoreVersion>2.0.0-*</AspNetCoreVersion>
<AspNetCoreIntegrationTestingVersion>0.4.0-*</AspNetCoreIntegrationTestingVersion>
<AspNetCoreModuleVersion>1.0.0-*</AspNetCoreModuleVersion>
<CoreFxVersion>4.3.0</CoreFxVersion>
<CoreFxVersion>4.4.0-*</CoreFxVersion>
<InternalAspNetCoreSdkVersion>2.1.0-*</InternalAspNetCoreSdkVersion>
<NETStandardImplicitPackageVersion>$(BundledNETStandardPackageVersion)</NETStandardImplicitPackageVersion>
<NETStandardLibraryNETFrameworkVersion>2.0.0-*</NETStandardLibraryNETFrameworkVersion>
<TestSdkVersion>15.3.0-*</TestSdkVersion>
<XunitVersion>2.3.0-beta2-*</XunitVersion>
</PropertyGroup>

View File

@ -3,7 +3,7 @@
<Import Project="..\..\build\dependencies.props" />
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
@ -15,4 +15,7 @@
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(AspNetCoreVersion)" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
<PackageReference Include="NETStandard.Library.NETFramework" Version="$(NETStandardLibraryNETFrameworkVersion)" />
</ItemGroup>
</Project>

View File

@ -4,7 +4,7 @@
<PropertyGroup>
<Description>ASP.NET Core components for working with the IIS AspNetCoreModule.</Description>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore;iis</PackageTags>

View File

@ -22,26 +22,39 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
[ConditionalTheory]
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
//[InlineData(RuntimeArchitecture.x86, ApplicationType.Portable)]
[InlineData(RuntimeArchitecture.x64, ApplicationType.Portable)]
public Task HelloWorld_IISExpress(RuntimeArchitecture architecture, ApplicationType applicationType)
[FrameworkSkipCondition(RuntimeFrameworks.CoreCLR)]
//[InlineData(RuntimeFlavor.Clr, RuntimeArchitecture.x86, ApplicationType.Portable)]
[InlineData(RuntimeFlavor.Clr, RuntimeArchitecture.x64, ApplicationType.Portable)]
public Task HelloWorld_IISExpress(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType)
{
return HelloWorld(ServerType.IISExpress, architecture, applicationType);
return HelloWorld(ServerType.IISExpress, runtimeFlavor, architecture, applicationType);
}
private async Task HelloWorld(ServerType serverType, RuntimeArchitecture architecture, ApplicationType applicationType)
[ConditionalTheory]
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
[FrameworkSkipCondition(RuntimeFrameworks.CLR)]
//[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, ApplicationType.Portable)]
// TODO reenable when https://github.com/aspnet/IISIntegration/issues/373 is resolved
//[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Standalone)]
[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Portable)]
public Task HelloWorld_IISExpress_CoreClr(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType)
{
var testName = $"HelloWorld_{serverType}_{architecture}";
return HelloWorld(ServerType.IISExpress, runtimeFlavor, architecture, applicationType);
}
private async Task HelloWorld(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType)
{
var testName = $"HelloWorld_{serverType}_{runtimeFlavor}_{architecture}";
using (StartLog(out var loggerFactory, testName))
{
var logger = loggerFactory.CreateLogger("HelloWorldTest");
var deploymentParameters = new DeploymentParameters(Helpers.GetTestSitesPath(), serverType, RuntimeFlavor.CoreClr, architecture)
var deploymentParameters = new DeploymentParameters(Helpers.GetTestSitesPath(), serverType, runtimeFlavor, architecture)
{
EnvironmentName = "HelloWorld", // Will pick the Start class named 'StartupHelloWorld',
ServerConfigTemplateContent = (serverType == ServerType.IISExpress) ? File.ReadAllText("Http.config") : null,
SiteName = "HttpTestSite", // This is configured in the Http.config
TargetFramework = "netcoreapp2.0",
TargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net461" : "netcoreapp2.0",
ApplicationType = applicationType
};

View File

@ -25,29 +25,40 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
{
}
[ConditionalTheory(Skip = "No test configuration enabled")]
[ConditionalTheory]
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
//[InlineData(RuntimeArchitecture.x86, "https://localhost:44394/", ApplicationType.Portable)]
[InlineData(RuntimeArchitecture.x64, "https://localhost:44395/", ApplicationType.Standalone)]
public Task Https_HelloWorld(RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType)
[FrameworkSkipCondition(RuntimeFrameworks.CoreCLR)]
[InlineData(RuntimeFlavor.Clr, RuntimeArchitecture.x64, "https://localhost:44396/", ApplicationType.Portable)]
public Task Https_HelloWorld(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType)
{
return HttpsHelloWorld(ServerType.IISExpress, architecture, applicationBaseUrl, applicationType);
return HttpsHelloWorld(ServerType.IISExpress, runtimeFlavor, architecture, applicationBaseUrl, applicationType);
}
private async Task HttpsHelloWorld(ServerType serverType, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType)
[ConditionalTheory(Skip = "No test configuration enabled")]
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
[FrameworkSkipCondition(RuntimeFrameworks.CLR)]
//[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, "https://localhost:44394/", ApplicationType.Portable)]
// TODO reenable when https://github.com/aspnet/IISIntegration/issues/373 is resolved
//[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "https://localhost:44395/", ApplicationType.Standalone)]
public Task Https_HelloWorld_CoreCLR(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType)
{
var testName = $"HttpsHelloWorld_{serverType}_{architecture}";
return HttpsHelloWorld(ServerType.IISExpress, runtimeFlavor, architecture, applicationBaseUrl, applicationType);
}
private async Task HttpsHelloWorld(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType)
{
var testName = $"HttpsHelloWorld_{serverType}_{runtimeFlavor}_{architecture}";
using (StartLog(out var loggerFactory, testName))
{
var logger = loggerFactory.CreateLogger("HttpsHelloWorldTest");
var deploymentParameters = new DeploymentParameters(Helpers.GetTestSitesPath(), serverType, RuntimeFlavor.CoreClr, architecture)
var deploymentParameters = new DeploymentParameters(Helpers.GetTestSitesPath(), serverType, runtimeFlavor, architecture)
{
ApplicationBaseUriHint = applicationBaseUrl,
EnvironmentName = "HttpsHelloWorld", // Will pick the Start class named 'StartupHttpsHelloWorld',
ServerConfigTemplateContent = (serverType == ServerType.IISExpress) ? File.ReadAllText("Https.config") : null,
SiteName = "HttpsTestSite", // This is configured in the Https.config
TargetFramework = "netcoreapp2.0",
TargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net461" : "netcoreapp2.0",
ApplicationType = applicationType
};
@ -80,37 +91,58 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
}
}
[ConditionalTheory(Skip = "No test configuration enabled")]
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
[FrameworkSkipCondition(RuntimeFrameworks.CoreCLR)]
//[InlineData(RuntimeFlavor.Clr, RuntimeArchitecture.x86, "https://localhost:44399/", ApplicationType.Standalone)]
public Task Https_HelloWorld_NoClientCert(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType)
{
return HttpsHelloWorldCerts(ServerType.IISExpress, runtimeFlavor, architecture, applicationBaseUrl, applicationType, sendClientCert: false);
}
[ConditionalTheory]
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
//[InlineData(RuntimeArchitecture.x86, "https://localhost:44399/", ApplicationType.Standalone)]
[InlineData(RuntimeArchitecture.x64, "https://localhost:44398/", ApplicationType.Portable)]
public Task Https_HelloWorld_NoClientCert(RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType)
[FrameworkSkipCondition(RuntimeFrameworks.CLR)]
// TODO reenable when https://github.com/aspnet/IISIntegration/issues/373 is resolved
//[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "https://localhost:44397/", ApplicationType.Standalone)]
[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "https://localhost:44398/", ApplicationType.Portable)]
public Task Https_HelloWorld_NoClientCert_CoreCLR(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType)
{
return HttpsHelloWorldCerts(ServerType.IISExpress, architecture, applicationBaseUrl, applicationType, sendClientCert: false);
return HttpsHelloWorldCerts(ServerType.IISExpress, runtimeFlavor, architecture, applicationBaseUrl, applicationType, sendClientCert: false);
}
[ConditionalTheory(Skip = "Manual test only, selecting a client cert is non-determanistic on different machines.")]
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
[InlineData(RuntimeArchitecture.x64, "https://localhost:44301/", ApplicationType.Portable)]
public Task Https_HelloWorld_ClientCert(RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType)
[FrameworkSkipCondition(RuntimeFrameworks.CoreCLR)]
[InlineData(RuntimeFlavor.Clr, RuntimeArchitecture.x64, "https://localhost:44301/", ApplicationType.Portable)]
public Task Https_HelloWorld_ClientCert(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType)
{
return HttpsHelloWorldCerts(ServerType.IISExpress, architecture, applicationBaseUrl, applicationType, sendClientCert: true);
return HttpsHelloWorldCerts(ServerType.IISExpress, runtimeFlavor, architecture, applicationBaseUrl, applicationType, sendClientCert: true);
}
private async Task HttpsHelloWorldCerts(ServerType serverType, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType, bool sendClientCert)
[ConditionalTheory(Skip = "Manual test only, selecting a client cert is non-determanistic on different machines.")]
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
[FrameworkSkipCondition(RuntimeFrameworks.CLR)]
//[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, "https://localhost:44302/", ApplicationType.Standalone)]
public Task Https_HelloWorld_ClientCert_CoreCLR(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType)
{
var testName = $"HttpsHelloWorldCerts_{serverType}_{architecture}";
return HttpsHelloWorldCerts(ServerType.IISExpress, runtimeFlavor, architecture, applicationBaseUrl, applicationType, sendClientCert: true);
}
private async Task HttpsHelloWorldCerts(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType, bool sendClientCert)
{
var testName = $"HttpsHelloWorldCerts_{serverType}_{runtimeFlavor}_{architecture}";
using (StartLog(out var loggerFactory, testName))
{
var logger = loggerFactory.CreateLogger("HttpsHelloWorldTest");
var deploymentParameters = new DeploymentParameters(Helpers.GetTestSitesPath(), serverType, RuntimeFlavor.CoreClr, architecture)
var deploymentParameters = new DeploymentParameters(Helpers.GetTestSitesPath(), serverType, runtimeFlavor, architecture)
{
ApplicationBaseUriHint = applicationBaseUrl,
EnvironmentName = "HttpsHelloWorld", // Will pick the Start class named 'StartupHttpsHelloWorld',
ServerConfigTemplateContent = (serverType == ServerType.IISExpress) ? File.ReadAllText("Https.config") : null,
SiteName = "HttpsTestSite", // This is configured in the Https.config
TargetFramework = "netcoreapp2.0",
TargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net461" : "netcoreapp2.0",
ApplicationType = applicationType
};

View File

@ -3,7 +3,8 @@
<Import Project="..\..\build\common.props" />
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFrameworks>netcoreapp2.0</TargetFrameworks>
<NoWarn>$(NoWarn);xUnit1003</NoWarn>
</PropertyGroup>
<ItemGroup>

View File

@ -24,15 +24,27 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
[ConditionalTheory]
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
[InlineData(RuntimeArchitecture.x64, ApplicationType.Portable)]
public Task NtlmAuthentication(RuntimeArchitecture architecture, ApplicationType applicationType)
[FrameworkSkipCondition(RuntimeFrameworks.CoreCLR)]
[InlineData(RuntimeFlavor.Clr, RuntimeArchitecture.x64, ApplicationType.Portable)]
public Task NtlmAuthentication(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType)
{
return NtlmAuthentication(ServerType.IISExpress, architecture, applicationType);
return NtlmAuthentication(ServerType.IISExpress, runtimeFlavor, architecture, applicationType);
}
private async Task NtlmAuthentication(ServerType serverType, RuntimeArchitecture architecture, ApplicationType applicationType)
[ConditionalTheory(Skip = "No test configuration enabled")]
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
[FrameworkSkipCondition(RuntimeFrameworks.CLR)]
//[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, ApplicationType.Standalone)]
// TODO reenable when https://github.com/aspnet/IISIntegration/issues/373 is resolved
//[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Standalone)]
Task NtlmAuthentication_CoreCLR(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType)
{
var testName = $"NtlmAuthentication_{serverType}_{architecture}";
return NtlmAuthentication(ServerType.IISExpress, runtimeFlavor, architecture, applicationType);
}
private async Task NtlmAuthentication(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType)
{
var testName = $"NtlmAuthentication_{serverType}_{runtimeFlavor}_{architecture}";
using (StartLog(out var loggerFactory, testName))
{
var logger = loggerFactory.CreateLogger("NtlmAuthenticationTest");
@ -41,14 +53,14 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
? "win7-x64"
: "win7-x86";
var deploymentParameters = new DeploymentParameters(Helpers.GetTestSitesPath(), serverType, RuntimeFlavor.CoreClr, architecture)
var deploymentParameters = new DeploymentParameters(Helpers.GetTestSitesPath(), serverType, runtimeFlavor, architecture)
{
EnvironmentName = "NtlmAuthentication", // Will pick the Start class named 'StartupNtlmAuthentication'
ServerConfigTemplateContent = (serverType == ServerType.IISExpress) ? File.ReadAllText("NtlmAuthentation.config") : null,
SiteName = "NtlmAuthenticationTestSite", // This is configured in the NtlmAuthentication.config
TargetFramework = "netcoreapp2.0",
TargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net461" : "netcoreapp2.0",
ApplicationType = applicationType,
AdditionalPublishParameters = ApplicationType.Standalone == applicationType
AdditionalPublishParameters = ApplicationType.Standalone == applicationType && RuntimeFlavor.CoreClr == runtimeFlavor
? "-r " + windowsRid
: null
};
@ -76,7 +88,6 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.Equal("Anonymous?True", responseText);
/* Disabled for due to https://github.com/aspnet/ServerTests/issues/82
response = await httpClient.GetAsync("/Restricted");
responseText = await response.Content.ReadAsStringAsync();
Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode);
@ -93,7 +104,6 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
response = await httpClient.GetAsync("/Forbidden");
responseText = await response.Content.ReadAsStringAsync();
Assert.Equal(HttpStatusCode.Forbidden, response.StatusCode);
*/
var httpClientHandler = new HttpClientHandler() { UseDefaultCredentials = true };
httpClient = deploymentResult.CreateHttpClient(httpClientHandler);

View File

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

View File

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