Skip to content

Commit 85b9ca1

Browse files
committed
Fix passing of RIDs in dotnet publish for back-compat
1 parent 8547e2c commit 85b9ca1

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/Aspire.Hosting/Publishing/ResourceContainerImageBuilder.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,20 @@ private async Task<bool> ExecuteDotnetPublishAsync(IResource resource, Container
272272

273273
if (options.TargetPlatform is not null)
274274
{
275-
arguments += $" /p:RuntimeIdentifiers=\"{options.TargetPlatform.Value.ToMSBuildRuntimeIdentifierString()}\"";
275+
// Use the appropriate MSBuild property based on the number of RIDs
276+
var runtimeIds = options.TargetPlatform.Value.ToMSBuildRuntimeIdentifierString();
277+
var ridArray = runtimeIds.Split(';');
278+
279+
if (ridArray.Length == 1)
280+
{
281+
// Single platform - use ContainerRuntimeIdentifier
282+
arguments += $" /p:ContainerRuntimeIdentifier=\"{ridArray[0]}\"";
283+
}
284+
else
285+
{
286+
// Multiple platforms - use RuntimeIdentifiers
287+
arguments += $" /p:RuntimeIdentifiers=\"{runtimeIds}\"";
288+
}
276289
}
277290
}
278291

0 commit comments

Comments
 (0)