Skip to content

Commit

Permalink
Merge pull request #28484 from nagilson/nagilson-runtimeIdentifiers-CC
Browse files Browse the repository at this point in the history
RuntimeIdentifiers Code Coverage + Implicit RuntimeIdentifiers (not just runtimeIdentifier)
  • Loading branch information
nagilson authored Oct 31, 2022
2 parents 0c83cbb + 6018960 commit 10d7bb2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ Copyright (c) .NET Foundation. All rights reserved.
<PropertyGroup Condition="'$(UseCurrentRuntimeIdentifier)' == 'true' or
(
'$(RuntimeIdentifier)' == '' and
'$(RuntimeIdentifiers)' == '' and
(
'$(SelfContained)' == 'true' or
'$(PublishReadyToRun)' == 'true' or
Expand Down Expand Up @@ -162,19 +161,19 @@ Copyright (c) .NET Foundation. All rights reserved.
Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and '$(HasRuntimeOutput)' == 'true'">

<!-- The following RID errors are asserts, and we don't expect them to ever occur. The error message is added as a safeguard.-->
<NETSdkError Condition="'$(SelfContained)' == 'true' and '$(RuntimeIdentifier)' == '' and '$(RuntimeIdentifiers)' == ''"
<NETSdkError Condition="'$(SelfContained)' == 'true' and '$(RuntimeIdentifier)' == ''"
ResourceName="ImplicitRuntimeIdentifierResolutionForPublishPropertyFailed"
FormatArguments="SelfContained"/>

<NETSdkError Condition="'$(PublishReadyToRun)' == 'true' and '$(RuntimeIdentifier)' == '' and '$(RuntimeIdentifiers)' == ''"
<NETSdkError Condition="'$(PublishReadyToRun)' == 'true' and '$(RuntimeIdentifier)' == ''"
ResourceName="ImplicitRuntimeIdentifierResolutionForPublishPropertyFailed"
FormatArguments="PublishReadyToRun"/>

<NETSdkError Condition="'$(PublishSingleFile)' == 'true' and '$(RuntimeIdentifier)' == '' and '$(RuntimeIdentifiers)' == ''"
<NETSdkError Condition="'$(PublishSingleFile)' == 'true' and '$(RuntimeIdentifier)' == ''"
ResourceName="ImplicitRuntimeIdentifierResolutionForPublishPropertyFailed"
FormatArguments="PublishSingleFile"/>

<NETSdkError Condition="'$(PublishAot)' == 'true' and '$(RuntimeIdentifier)' == '' and '$(RuntimeIdentifiers)' == ''"
<NETSdkError Condition="'$(PublishAot)' == 'true' and '$(RuntimeIdentifier)' == ''"
ResourceName="ImplicitRuntimeIdentifierResolutionForPublishPropertyFailed"
FormatArguments="PublishAot"/>

Expand Down
23 changes: 23 additions & 0 deletions src/Tests/Microsoft.NET.Publish.Tests/RuntimeIdentifiersTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.IO;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using FluentAssertions;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.NET.TestFramework;
Expand Down Expand Up @@ -218,5 +219,27 @@ public void DuplicateRuntimeIdentifiers()
.Pass();

}

[Fact]
public void PublishSuccessfullyWithRIDRequiringPropertyAndRuntimeIdentifiersNoRuntimeIdentifier()
{
var targetFramework = ToolsetInfo.CurrentTargetFramework;
var runtimeIdentifier = EnvironmentInfo.GetCompatibleRid(targetFramework);
var testProject = new TestProject()
{
IsExe = true,
TargetFrameworks = targetFramework
};

testProject.AdditionalProperties["RuntimeIdentifiers"] = runtimeIdentifier;
testProject.AdditionalProperties["PublishReadyToRun"] = "true";
var testAsset = _testAssetsManager.CreateTestProject(testProject);

var publishCommand = new PublishCommand(testAsset);
publishCommand
.Execute()
.Should()
.Pass();
}
}
}

0 comments on commit 10d7bb2

Please sign in to comment.