Skip to content
This repository has been archived by the owner on Dec 19, 2018. It is now read-only.

Commit

Permalink
Update self host deployer to target specific framework when lauching …
Browse files Browse the repository at this point in the history
…without publish
  • Loading branch information
JunTaoLuo committed May 6, 2016
1 parent 642cdc0 commit 3337c28
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ public DeploymentParameters(

public string ApplicationPath { get; set; }

public string TargetFramework { get; set; }

/// <summary>
/// To publish the application before deployment.
/// </summary>
public bool PublishApplicationBeforeDeployment { get; set; }

public ApplicationType ApplicationType { get; set; }

public string PublishTargetFramework { get; set; }

public string PublishedApplicationRootPath { get; set; }

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public ApplicationDeployer(DeploymentParameters deploymentParameters, ILogger lo

protected void DotnetPublish(string publishRoot = null)
{
if (string.IsNullOrEmpty(DeploymentParameters.PublishTargetFramework))
if (string.IsNullOrEmpty(DeploymentParameters.TargetFramework))
{
throw new Exception($"A target framework must be specified in the deployment parameters for applications that require publishing before deployment");
}
Expand All @@ -49,7 +49,7 @@ protected void DotnetPublish(string publishRoot = null)

var parameters = $"publish \"{DeploymentParameters.ApplicationPath}\""
+ $" -o \"{DeploymentParameters.PublishedApplicationRootPath}\""
+ $" --framework {DeploymentParameters.PublishTargetFramework}";
+ $" --framework {DeploymentParameters.TargetFramework}";

Logger.LogInformation($"Executing command {DotnetCommandName} {parameters}");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@ protected CancellationToken StartSelfHost(Uri uri)
}
else
{
var targetFramework = DeploymentParameters.TargetFramework ?? (DeploymentParameters.RuntimeFlavor == RuntimeFlavor.Clr ? "net451" : "netcoreapp1.0");

executableName = DotnetCommandName;
executableArgs = $"run -p \"{DeploymentParameters.ApplicationPath}\" {DotnetArgumentSeparator}";
executableArgs = $"run -p \"{DeploymentParameters.ApplicationPath}\" --framework {targetFramework} {DotnetArgumentSeparator}";
}

executableArgs += $" --server.urls {uri} "
Expand Down

0 comments on commit 3337c28

Please sign in to comment.