Issue Description
Isolated graph doesn't work with nuget restore. Since dotnet build includes restore by default, it means dotnet build --graph --isolate is broken without also specifying --no-restore.
Steps to Reproduce
In an empty directory run these commands:
dotnet new classlib -o lib1
dotnet new classlib -o lib2
dotnet add lib2 reference lib1
dotnet build --graph --isolate lib2
Expected Behavior
A successful build
Actual Behavior
The isolated graph fails during the restore target.
❯ dotnet build --graph --isolate lib2
Microsoft (R) Build Engine version 16.11.0+0538acc04 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
C:\Users\andarno\.dotnet\sdk\5.0.401\NuGet.targets(1056,5): error : MSB4252: Project "C:\temp\graph\lib2\lib2.csproj" with global properties [C:\temp\graph\lib2\lib2.csproj]
C:\Users\andarno\.dotnet\sdk\5.0.401\NuGet.targets(1056,5): error : (MSBuildRestoreSessionId=f0e229a6-26f8-45ce-812d-ae2228f1b6a1; ExcludeRestorePackageImports=true) [C:\temp\graph\lib2\lib2.csproj]
C:\Users\andarno\.dotnet\sdk\5.0.401\NuGet.targets(1056,5): error : is building project "C:\temp\graph\lib1\lib1.csproj" with global properties [C:\temp\graph\lib2\lib2.csproj]
C:\Users\andarno\.dotnet\sdk\5.0.401\NuGet.targets(1056,5): error : (MSBuildRestoreSessionId=f0e229a6-26f8-45ce-812d-ae2228f1b6a1; ExcludeRestorePackageImports=true) [C:\temp\graph\lib2\lib2.csproj]
C:\Users\andarno\.dotnet\sdk\5.0.401\NuGet.targets(1056,5): error : with the (_GenerateRestoreProjectPathWalk) 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: [C:\temp\graph\lib2\lib2.csproj]
C:\Users\andarno\.dotnet\sdk\5.0.401\NuGet.targets(1056,5): error : - the reference was called with a target which is not specified in the ProjectReferenceTargets item in project "C:\temp\graph\lib2\lib2.csproj" [C:\temp\graph\lib2\lib2.csproj]
C:\Users\andarno\.dotnet\sdk\5.0.401\NuGet.targets(1056,5): error : - the reference was called with global properties that do not match the static graph inferred nodes [C:\temp\graph\lib2\lib2.csproj]
C:\Users\andarno\.dotnet\sdk\5.0.401\NuGet.targets(1056,5): error : - the reference was not explicitly specified as a ProjectReference item in project "C:\temp\graph\lib2\lib2.csproj" [C:\temp\graph\lib2\lib2.csproj]
C:\Users\andarno\.dotnet\sdk\5.0.401\NuGet.targets(1056,5): error : [C:\temp\graph\lib2\lib2.csproj]
Build FAILED.
Interestingly, the failure if building lib1 appears to be entirely different, yet also succeeds if you add --no-restore to the command line:
❯ dotnet build --graph --isolate .\lib1\lib1.csproj
Microsoft (R) Build Engine version 16.11.0+0538acc04 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
All projects are up-to-date for restore.
C:\temp\graph\lib1\lib1\lib1.csproj : error MSB4025: The project file could not be loaded. Could not find a part of the path 'C:\temp\graph\lib1\lib1\lib1.csproj'.
Build FAILED.
C:\temp\graph\lib1\lib1\lib1.csproj : error MSB4025: The project file could not be loaded. Could not find a part of the path 'C:\temp\graph\lib1\lib1\lib1.csproj'.
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.48
Versions & Configurations
> dotnet --info
.NET SDK (reflecting any global.json):
Version: 5.0.401
Commit: 4bef5f3dbf
Issue Description
Isolated graph doesn't work with nuget restore. Since
dotnet buildincludes restore by default, it meansdotnet build --graph --isolateis broken without also specifying--no-restore.Steps to Reproduce
In an empty directory run these commands:
Expected Behavior
A successful build
Actual Behavior
The isolated graph fails during the restore target.
Interestingly, the failure if building
lib1appears to be entirely different, yet also succeeds if you add--no-restoreto the command line:Versions & Configurations