Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static graph restore failure when referencing unrestorable project #12322

Closed
rainersigwald opened this issue Dec 15, 2022 · 2 comments · Fixed by NuGet/NuGet.Client#5068
Closed

Comments

@rainersigwald
Copy link

NuGet Product Used

dotnet.exe, MSBuild.exe

Product Version

.NET SDK 7.0.100; VS 17.5 internal preview

Worked before?

Not a regression

Impact

It's more difficult to complete my work

Repro Steps & Context

Given a project that has a ProjectReference to a project that doesn't import NuGet.targets, like Something\Something.csproj referencing the empty project asdf.proj in GraphRestoreFailsOnUnrestorableReference.zip, graph-based restore can fail when non-graph-based restore succeeds.

dotnet restore  -p:RestoreUseStaticGraphEvaluation=true .\Something\
  Determining projects to restore...
S:\play\alkestj\Something\Something.csproj : error NU1105: Unable to find project information for 'S:\play\alkestj\asdf.proj'. If you are using Visual Studio, this may be because the project is unloaded or not part of the current solution so run a restore from the command-line. Otherwise, the project file may be invalid or missing 
targets required for restore.
  Failed to restore S:\play\alkestj\Something\Something.csproj (in 54 ms).

Looking at the dgspec, non-graph restore elides the projectReferences entry for the reference to the non-restorable project, while graph restore includes it.

diff --git "a/.\\Something\\obj\\nongraph_Something.csproj.nuget.dgspec.json" "b/.\\Something\\obj\\Something.csproj.nuget.dgspec.json"
index 3468b15..e9b26cf 100644
--- "a/.\\Something\\obj\\nongraph_Something.csproj.nuget.dgspec.json"
+++ "b/.\\Something\\obj\\Something.csproj.nuget.dgspec.json"
@@ -32,7 +32,11 @@
         "frameworks": {
           "net7.0": {
             "targetAlias": "net7.0",
-            "projectReferences": {}
+            "projectReferences": {
+              "S:\\play\\alkestj\\asdf.proj": {
+                "projectPath": "S:\\play\\alkestj\\asdf.proj"
+              }
+            }
           }
         },
         "warningProperties": {

Since there is in fact no info for that project, this leads to a failure later.

Verbose Logs

No response

@rainersigwald
Copy link
Author

@erdembayar
Copy link
Contributor

I can repro this.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants