Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -790,9 +790,9 @@ Copyright (c) .NET Foundation. All rights reserved.

<!--
============================================================
_GetAppHostPaths
Gets the path to apphost (restored via packages or in an apphost pack),
and computes the path for the destination apphost.
_GetAppHostCreationConfiguration
Computes the properties for configuration of apphost creation
during either build or publish
============================================================
-->
<Target Name="_GetAppHostCreationConfiguration"
Expand Down Expand Up @@ -981,7 +981,7 @@ Copyright (c) .NET Foundation. All rights reserved.
============================================================
-->
<Target Name="_ComputeNETCoreBuildOutputFiles"
DependsOnTargets="_GetAppHostPaths;_GetComHostPaths;_GetIjwHostPaths"
DependsOnTargets="_GetAppHostPaths;_GetAppHostCreationConfiguration;_GetComHostPaths;_GetIjwHostPaths"
BeforeTargets="AssignTargetPaths"
Condition="'$(ComputeNETCoreBuildOutputFiles)' == 'true'">

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,44 @@ public void It_does_not_rewrite_the_single_file_unnecessarily()
fileWriteTimeAfterSecondRun.Should().Be(fileWriteTimeAfterFirstRun);
}

[RequiresMSBuildVersionFact("16.8.0")]
public void It_uses_appropriate_host_on_selfcontained_publish_with_no_build()
{
var testProject = new TestProject()
{
Name = "SingleFileTest",
TargetFrameworks = ToolsetInfo.CurrentTargetFramework,
RuntimeIdentifier = RuntimeInformation.RuntimeIdentifier,
IsExe = true,
};
testProject.AdditionalProperties.Add("SelfContained", "true");
TestAsset testAsset = _testAssetsManager.CreateTestProject(testProject);

// Build will create app using apphost
var buildCommand = new BuildCommand(testAsset);
buildCommand
.Execute()
.Should()
.Pass();

// Publish without build should create app using singlefilehost
var publishCommand = new PublishCommand(testAsset);
publishCommand
.Execute(PublishSingleFile, "/p:NoBuild=true")
.Should()
.Pass();
string singleFilePath = Path.Combine(
GetPublishDirectory(publishCommand).FullName,
$"{testProject.Name}{Constants.ExeSuffix}");

// Make sure published app runs correctly
var command = new RunExeCommand(Log, singleFilePath);
command.Execute()
.Should()
.Pass()
.And.HaveStdOutContaining("Hello World");
}

[RequiresMSBuildVersionFact("16.8.0")]
public void It_rewrites_the_apphost_for_single_file_publish()
{
Expand Down