Skip to content

Commit

Permalink
UseCurrentRuntimeIdentifier when no rid specified
Browse files Browse the repository at this point in the history
  • Loading branch information
WeihanLi committed Aug 14, 2021
1 parent d82f08a commit 0d164ae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 6 additions & 1 deletion src/Cli/dotnet/commands/dotnet-publish/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ public static PublishCommand FromArgs(string[] args, string msbuildPath = null)
parseResult.HasOption(PublishCommandParser.NoSelfContainedOption));

msbuildArgs.AddRange(parseResult.OptionValuesToBeForwarded(PublishCommandParser.GetCommand()));


if (parseResult.GetCommandLineRuntimeIdentifier() is null)
{
msbuildArgs.AddRange(new[] { "-property:UseCurrentRuntimeIdentifier=True" });
}

msbuildArgs.AddRange(parseResult.ValueForArgument<IEnumerable<string>>(PublishCommandParser.SlnOrProjectArgument) ?? Array.Empty<string>());

bool noRestore = parseResult.HasOption(PublishCommandParser.NoRestoreOption)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public GivenThatWeWantToPublishASelfContainedApp(ITestOutputHelper log) : base(l
}

[Fact]
public void It_errors_when_publishing_self_contained_app_without_rid()
public void It_should_not_fail_when_publishing_self_contained_app_without_rid()
{
var testAsset = _testAssetsManager
.CopyTestAsset(TestProjectName)
Expand All @@ -37,9 +37,7 @@ public void It_errors_when_publishing_self_contained_app_without_rid()
"/p:SelfContained=true",
$"/p:TargetFramework={TargetFramework}")
.Should()
.Fail()
.And
.HaveStdOutContaining(Strings.CannotHaveSelfContainedWithoutRuntimeIdentifier);
.Pass();
}

[Fact]
Expand Down

0 comments on commit 0d164ae

Please sign in to comment.