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 @@ -27,7 +27,6 @@ Copyright (c) .NET Foundation. All rights reserved.
<PropertyGroup>
<_ToolsSettingsFilePath>$(BaseIntermediateOutputPath)DotnetToolSettings.xml</_ToolsSettingsFilePath>
<SuppressDependenciesWhenPacking Condition=" '$(PackAsTool)' == 'true' ">true</SuppressDependenciesWhenPacking>
<UseAppHost Condition=" '$(SelfContained)' != 'true' and '$(PackAsTool)' == 'true' ">false</UseAppHost>
</PropertyGroup>

<Target Name="PackTool" DependsOnTargets="GenerateToolsSettingsFileFromBuildProperty;Publish;_PackToolValidation" Condition=" '$(PackAsTool)' == 'true' ">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ Copyright (c) .NET Foundation. All rights reserved.
<SelfContained Condition="'$(SelfContained)' == '' and '$(RuntimeIdentifier)' != ''">true</SelfContained>
<SelfContained Condition="'$(SelfContained)' == ''">false</SelfContained>
<UseAppHost Condition="'$(UseAppHost)' == '' and
('$(SelfContained)' == 'true' or '$(PackAsTool)' != 'true') and
('$(SelfContained)' == 'true' or
('$(RuntimeIdentifier)' != '' and '$(_TargetFrameworkVersionWithoutV)' >= '2.1') or
'$(_TargetFrameworkVersionWithoutV)' >= '3.0')">true</UseAppHost>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ namespace Microsoft.NET.ToolPack.Tests
public class GivenThatWeWantToPackAToolProject : SdkTest
{
private string _testRoot;
private string _targetFrameworkOrFrameworks = "netcoreapp2.1";

public GivenThatWeWantToPackAToolProject(ITestOutputHelper log) : base(log)
{
}

private string SetupNuGetPackage(bool multiTarget, [CallerMemberName] string callingMethod = "")
{

TestAsset helloWorldAsset = _testAssetsManager
.CopyTestAsset("PortableTool", callingMethod + multiTarget)
.WithSource()
Expand All @@ -36,7 +38,7 @@ private string SetupNuGetPackage(bool multiTarget, [CallerMemberName] string cal
XNamespace ns = project.Root.Name.Namespace;
XElement propertyGroup = project.Root.Elements(ns + "PropertyGroup").First();
})
.WithTargetFrameworkOrFrameworks("netcoreapp2.1", multiTarget)
.WithTargetFrameworkOrFrameworks(_targetFrameworkOrFrameworks, multiTarget)
.Restore(Log);

_testRoot = helloWorldAsset.TestRoot;
Expand Down Expand Up @@ -128,6 +130,8 @@ public void It_contains_runtimeconfig_for_each_tfm(bool multiTarget)
[InlineData(false)]
public void It_does_not_contain_apphost_exe(bool multiTarget)
{
_targetFrameworkOrFrameworks = "netcoreapp3.0";

var nugetPackage = SetupNuGetPackage(multiTarget);
using (var nupkgReader = new PackageArchiveReader(nugetPackage))
{
Expand All @@ -141,6 +145,17 @@ public void It_does_not_contain_apphost_exe(bool multiTarget)
allItems.Should().NotContain($"tools/{framework.GetShortFolderName()}/any/consoledemo{extension}");
}
}

var getValuesCommand = new GetValuesCommand(
Log,
_testRoot,
_targetFrameworkOrFrameworks,
"RunCommand",
GetValuesCommand.ValueType.Property);

getValuesCommand.Execute();
Path.GetExtension(getValuesCommand.GetValues().Single())
.Should().NotBe(".exe", "Repro https://github.com/dotnet/cli/issues/11299");
}

[Theory]
Expand Down