- 
                Notifications
    
You must be signed in to change notification settings  - Fork 379
 
Fix inconsistent NuGet restore generation #5172
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| 
          
            
          
           | 
    @@ -239,7 +239,7 @@ | |
| 
     | 
||
| <MSBuild Projects="@(_ProjectToRestore)" | ||
| Properties="@(_SolutionBuildProps);__BuildPhase=SolutionRestore;_NETCORE_ENGINEERING_TELEMETRY=Restore;MSBuildRestoreSessionId=$([System.Guid]::NewGuid())" | ||
| RemoveProperties="$(_RemoveProps)" | ||
| RemoveProperties="$(_RemoveProps);TreatWarningsAsErrors" | ||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📝 The  There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The way you proposed the change won't it affect every kind of build? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like a bug in NuGet. Is there an issue tracking it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 
 Only the  
 I have no idea if this a bug or by-design in NuGet. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @nkolev92 Any idea? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @nkolev92 The problem occurs for projects with this configuration: <PropertyGroup Condition="'$(BuildingInsideVisualStudio)' != 'true'">
  <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>This is a de-facto standard approach to warnings in managed code. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see. 
 Wasn't familiar with this. A bunch of the dotnet/* projects have warnings as errors on by default, maybe NuGet's handling is one reason why :) In our sln of 80 projects, restore would go from ~2s, to 9s if we did this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will this change end up being disruptive? Any insight into how many builds will suddenly fall over when warnings are now treated as errors? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is going the other way around. We are forcing  There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ooops, sorry. :) I'm cool with @JohnTortugo is cool.  | 
||
| Targets="Restore" | ||
| SkipNonexistentTargets="true" | ||
| BuildInParallel="%(_ProjectToRestore.RestoreInParallel)" | ||
| 
          
            
          
           | 
    ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this also a NuGet bug? Shouldn't it normalize the paths that it's writing into files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both ways work. If the separator isn't here, then it gets added to the generated files. The problem is even though the semantics are the same, the change itself produces different hashes and the regeneration occurs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, but if NuGet always normalized the path separator we wouldn't need to make these changes (and most importantly, maintain them). It is entirely non-obvious that not adding the terminating separator makes a difference. On that note, let's add a comment ...
/cc @nkolev92
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're tracking this in NuGet/Home#7968.
I'll look into it this sprint.
I assume any project would break?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so (not really break, but not reuse the restore data). @sharwell could you add a comment to the code with a link to NuGet/Home#7968?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I guess that's what I meant by break.
Defeat the incremental check when it shouldn't :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a link.