Supply runtime identifier on publishing standalone apps

This commit is contained in:
Kiran Challa 2017-04-06 15:02:20 -07:00
parent a8c61b5abc
commit f1a59d030e
3 changed files with 28 additions and 3 deletions

View File

@ -2,6 +2,7 @@
<PropertyGroup> <PropertyGroup>
<AspNetCoreVersion>2.0.0-*</AspNetCoreVersion> <AspNetCoreVersion>2.0.0-*</AspNetCoreVersion>
<CoreFxVersion>4.3.0</CoreFxVersion> <CoreFxVersion>4.3.0</CoreFxVersion>
<DotNetPlatformAbstractionsVersion>1.1.0</DotNetPlatformAbstractionsVersion>
<InternalAspNetCoreSdkVersion>2.0.0-*</InternalAspNetCoreSdkVersion> <InternalAspNetCoreSdkVersion>2.0.0-*</InternalAspNetCoreSdkVersion>
<NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion> <NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion>
<RuntimeFrameworkVersion>2.0.0-*</RuntimeFrameworkVersion> <RuntimeFrameworkVersion>2.0.0-*</RuntimeFrameworkVersion>

View File

@ -7,9 +7,9 @@ using System.Diagnostics;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IntegrationTesting.Common;
using Microsoft.Extensions.Internal; using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using PlatformAbstractions = Microsoft.DotNet.PlatformAbstractions;
namespace Microsoft.AspNetCore.Server.IntegrationTesting namespace Microsoft.AspNetCore.Server.IntegrationTesting
{ {
@ -56,8 +56,14 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting
var parameters = $"publish " var parameters = $"publish "
+ $" --output \"{DeploymentParameters.PublishedApplicationRootPath}\"" + $" --output \"{DeploymentParameters.PublishedApplicationRootPath}\""
+ $" --framework {DeploymentParameters.TargetFramework}" + $" --framework {DeploymentParameters.TargetFramework}"
+ $" --configuration {DeploymentParameters.Configuration}" + $" --configuration {DeploymentParameters.Configuration}";
+ $" {DeploymentParameters.AdditionalPublishParameters}";
if (DeploymentParameters.ApplicationType == ApplicationType.Standalone)
{
parameters += $" --runtime {GetRuntimeIdentifier()}";
}
parameters += $" {DeploymentParameters.AdditionalPublishParameters}";
var startInfo = new ProcessStartInfo var startInfo = new ProcessStartInfo
{ {
@ -205,5 +211,22 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting
} }
public abstract void Dispose(); public abstract void Dispose();
private string GetRuntimeIdentifier()
{
var architecture = PlatformAbstractions.RuntimeEnvironment.RuntimeArchitecture;
switch (PlatformAbstractions.RuntimeEnvironment.OperatingSystemPlatform)
{
case PlatformAbstractions.Platform.Windows:
return "win7-" + architecture;
case PlatformAbstractions.Platform.Linux:
return "linux-" + architecture;
case PlatformAbstractions.Platform.Darwin:
return "osx.10.12-" + architecture;
default:
throw new InvalidOperationException(
"Unrecognized operation system platform: " + PlatformAbstractions.RuntimeEnvironment.OperatingSystemPlatform);
}
}
} }
} }

View File

@ -23,6 +23,7 @@
<PackageReference Include="Microsoft.Extensions.Logging" Version="$(AspNetCoreVersion)" /> <PackageReference Include="Microsoft.Extensions.Logging" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(AspNetCoreVersion)" /> <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Testing" Version="$(AspNetCoreVersion)" /> <PackageReference Include="Microsoft.Extensions.Logging.Testing" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="$(DotNetPlatformAbstractionsVersion)" />
<PackageReference Include="Microsoft.Extensions.PlatformAbstractions" Version="$(AspNetCoreVersion)" /> <PackageReference Include="Microsoft.Extensions.PlatformAbstractions" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.Extensions.Process.Sources" Version="$(AspNetCoreVersion)" PrivateAssets="All" /> <PackageReference Include="Microsoft.Extensions.Process.Sources" Version="$(AspNetCoreVersion)" PrivateAssets="All" />
<PackageReference Include="Microsoft.Extensions.RuntimeEnvironment.Sources" Version="$(AspNetCoreVersion)" PrivateAssets="All" /> <PackageReference Include="Microsoft.Extensions.RuntimeEnvironment.Sources" Version="$(AspNetCoreVersion)" PrivateAssets="All" />