You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
dotnet build -graph -isolate -r <rid> fails for an app with a class library reference: GetTargetFrameworks is called without RuntimeIdentifier (MSB4252) #15711
With a global RuntimeIdentifier, an isolated static graph build of a console app that references a class library fails with MSB4252 in _GetProjectReferenceTargetFrameworkProperties. The same build without -r succeeds. It reproduces with the default console and classlib templates on .NET SDK 10.0.101 and 11.0.100.
Microsoft.Common.CurrentVersion.targets(1861,5): error : MSB4252: Project "app\app.csproj" with global properties
(NuGetInteractive=false; RuntimeIdentifier=win-x64; _CommandLineDefinedRuntimeIdentifier=true; IsGraphBuild=true)
is building project "lib\lib.csproj" with global properties
(NuGetInteractive=false; _CommandLineDefinedRuntimeIdentifier=true; IsGraphBuild=true)
with the (GetTargetFrameworks) target(s) but the build result for the built project is not in the engine cache. In isolated builds this could mean one of the following:
- the reference was called with a target which is not specified in the ProjectReferenceTargets item in project "app\app.csproj"
- the reference was called with global properties that do not match the static graph inferred nodes
- the reference was not explicitly specified as a ProjectReference item in project "app\app.csproj"
That is SDK 11.0.100. SDK 10.0.101 gives the same error from Microsoft.Common.CurrentVersion.targets(1844,5).
Analysis
_GetProjectReferenceTargetFrameworkProperties calls GetTargetFrameworks on each reference with RemoveProperties="...;TargetFramework;RuntimeIdentifier;SelfContained;...". So it asks for lib without the global RuntimeIdentifier=win-x64, a node the static graph did not predict, and -isolate rejects the call.
Activity