Skip to content

Commit 10d7bb2

Browse files
authored
Merge pull request #28484 from nagilson/nagilson-runtimeIdentifiers-CC
RuntimeIdentifiers Code Coverage + Implicit RuntimeIdentifiers (not just runtimeIdentifier)
2 parents 0c83cbb + 6018960 commit 10d7bb2

File tree

2 files changed

+27
-5
lines changed

2 files changed

+27
-5
lines changed

src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ Copyright (c) .NET Foundation. All rights reserved.
6464
<PropertyGroup Condition="'$(UseCurrentRuntimeIdentifier)' == 'true' or
6565
(
6666
'$(RuntimeIdentifier)' == '' and
67-
'$(RuntimeIdentifiers)' == '' and
6867
(
6968
'$(SelfContained)' == 'true' or
7069
'$(PublishReadyToRun)' == 'true' or
@@ -162,19 +161,19 @@ Copyright (c) .NET Foundation. All rights reserved.
162161
Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and '$(HasRuntimeOutput)' == 'true'">
163162

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

169-
<NETSdkError Condition="'$(PublishReadyToRun)' == 'true' and '$(RuntimeIdentifier)' == '' and '$(RuntimeIdentifiers)' == ''"
168+
<NETSdkError Condition="'$(PublishReadyToRun)' == 'true' and '$(RuntimeIdentifier)' == ''"
170169
ResourceName="ImplicitRuntimeIdentifierResolutionForPublishPropertyFailed"
171170
FormatArguments="PublishReadyToRun"/>
172171

173-
<NETSdkError Condition="'$(PublishSingleFile)' == 'true' and '$(RuntimeIdentifier)' == '' and '$(RuntimeIdentifiers)' == ''"
172+
<NETSdkError Condition="'$(PublishSingleFile)' == 'true' and '$(RuntimeIdentifier)' == ''"
174173
ResourceName="ImplicitRuntimeIdentifierResolutionForPublishPropertyFailed"
175174
FormatArguments="PublishSingleFile"/>
176175

177-
<NETSdkError Condition="'$(PublishAot)' == 'true' and '$(RuntimeIdentifier)' == '' and '$(RuntimeIdentifiers)' == ''"
176+
<NETSdkError Condition="'$(PublishAot)' == 'true' and '$(RuntimeIdentifier)' == ''"
178177
ResourceName="ImplicitRuntimeIdentifierResolutionForPublishPropertyFailed"
179178
FormatArguments="PublishAot"/>
180179

src/Tests/Microsoft.NET.Publish.Tests/RuntimeIdentifiersTests.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.IO;
77
using System.Linq;
88
using System.Text;
9+
using System.Xml.Linq;
910
using FluentAssertions;
1011
using Microsoft.DotNet.Cli.Utils;
1112
using Microsoft.NET.TestFramework;
@@ -218,5 +219,27 @@ public void DuplicateRuntimeIdentifiers()
218219
.Pass();
219220

220221
}
222+
223+
[Fact]
224+
public void PublishSuccessfullyWithRIDRequiringPropertyAndRuntimeIdentifiersNoRuntimeIdentifier()
225+
{
226+
var targetFramework = ToolsetInfo.CurrentTargetFramework;
227+
var runtimeIdentifier = EnvironmentInfo.GetCompatibleRid(targetFramework);
228+
var testProject = new TestProject()
229+
{
230+
IsExe = true,
231+
TargetFrameworks = targetFramework
232+
};
233+
234+
testProject.AdditionalProperties["RuntimeIdentifiers"] = runtimeIdentifier;
235+
testProject.AdditionalProperties["PublishReadyToRun"] = "true";
236+
var testAsset = _testAssetsManager.CreateTestProject(testProject);
237+
238+
var publishCommand = new PublishCommand(testAsset);
239+
publishCommand
240+
.Execute()
241+
.Should()
242+
.Pass();
243+
}
221244
}
222245
}

0 commit comments

Comments
 (0)