diff --git a/src/SourceBuild/content/repo-projects/aspnetcore.proj b/src/SourceBuild/content/repo-projects/aspnetcore.proj
index 1849b9582016..a19b4ec2eadd 100644
--- a/src/SourceBuild/content/repo-projects/aspnetcore.proj
+++ b/src/SourceBuild/content/repo-projects/aspnetcore.proj
@@ -6,6 +6,8 @@
osx-$(Platform)
freebsd-$(Platform)
win-$(Platform)
+ <_portableRidOverridden Condition="'$(TargetRid)' != '$(OverrideTargetRid)'">true
+ <_portableRidOverridden Condition="'$(TargetRid)' == '$(OverrideTargetRid)'">false
$(StandardSourceBuildArgs.Replace('--publish', ''))
@@ -14,7 +16,7 @@
$(BuildCommandArgs) --no-build-repo-tasks
$(BuildCommandArgs) --no-build-nodejs
$(BuildCommandArgs) /p:PublishCompressedFilesPathPrefix=$(SourceBuiltAspNetCoreRuntime)
- $(BuildCommandArgs) /p:PortableBuild=false /p:TargetRuntimeIdentifier=$(OverrideTargetRid)
+ $(BuildCommandArgs) /p:PortableBuild=$(_portableRidOverridden) /p:TargetRuntimeIdentifier=$(OverrideTargetRid)
$(BuildCommandArgs) /p:MicrosoftNetFrameworkReferenceAssembliesVersion=1.0.0