IISIntegration#292 Test support for bin deployed aspnetcore.dll

This commit is contained in:
Chris R 2016-11-10 16:06:39 -08:00
parent b508223e1c
commit f8fbb15e14
2 changed files with 45 additions and 2 deletions

View File

@ -5,8 +5,9 @@ using System;
using System.Diagnostics;
using System.IO;
using System.Threading;
using Microsoft.Extensions.Logging;
using Microsoft.AspNetCore.Server.IntegrationTesting.Common;
using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Server.IntegrationTesting
{
@ -22,6 +23,16 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting
{
}
public bool IsWin8OrLater
{
get
{
var win8Version = new Version(6, 2);
return (new Version(RuntimeEnvironment.OperatingSystemVersion) >= win8Version);
}
}
public override DeploymentResult Deploy()
{
// Start timer
@ -57,6 +68,34 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting
// Pass on the applicationhost.config to iis express. With this don't need to pass in the /path /port switches as they are in the applicationHost.config
// We take a copy of the original specified applicationHost.Config to prevent modifying the one in the repo.
if (DeploymentParameters.ServerConfigTemplateContent.Contains("[ANCMPath]"))
{
string ancmPath;
if (!IsWin8OrLater)
{
// The nupkg build of ANCM does not support Win7. https://github.com/aspnet/AspNetCoreModule/issues/40.
ancmPath = @"%ProgramFiles%\IIS Express\aspnetcore.dll";
}
// Bin deployed by Microsoft.AspNetCore.AspNetCoreModule.nupkg
else if (DeploymentParameters.RuntimeFlavor == RuntimeFlavor.CoreClr
&& DeploymentParameters.ApplicationType == ApplicationType.Portable)
{
ancmPath = Path.Combine(contentRoot, @"runtimes\win7-x64\native\aspnetcore.dll");
}
else
{
ancmPath = Path.Combine(contentRoot, "aspnetcore.dll");
}
if (!File.Exists(ancmPath))
{
throw new FileNotFoundException("AspNetCoreModule could not be found.", ancmPath);
}
DeploymentParameters.ServerConfigTemplateContent =
DeploymentParameters.ServerConfigTemplateContent.Replace("[ANCMPath]", ancmPath);
}
DeploymentParameters.ServerConfigTemplateContent =
DeploymentParameters.ServerConfigTemplateContent
.Replace("[ApplicationPhysicalPath]", contentRoot)

View File

@ -28,11 +28,15 @@
"Microsoft.AspNetCore.Testing": "1.1.0-*",
"Microsoft.Extensions.FileProviders.Embedded": "1.1.0-*",
"Microsoft.Extensions.Logging.Abstractions": "1.1.0-*",
"Microsoft.Extensions.PlatformAbstractions": "1.1.0-*",
"Microsoft.Extensions.Process.Sources": {
"type": "build",
"version": "1.1.0-*"
},
"Microsoft.Extensions.PlatformAbstractions": "1.1.0-*",
"Microsoft.Extensions.RuntimeEnvironment.Sources": {
"type": "build",
"version": "1.1.0-*"
},
"NETStandard.Library": "1.6.1-*"
},
"frameworks": {