-
Notifications
You must be signed in to change notification settings - Fork 694
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
Add lib placeholder files for Visual Studio restores #1251
Conversation
This change moves the step to add placeholder files for transitive project detection from MSBuild into restore so that it will be applied to all restores. Previously only command line restores were getting this step. NuGet/Home#4629
it looks like earlier placeholder files were being added for packages.config, project.json and packagereference, but now only being done for PackageReference... why is that? |
} | ||
|
||
var targetFrameworkShortName = targetGraph.Framework.GetShortFolderName(); | ||
var libAnyPath = $"lib/{targetFrameworkShortName}/any.dll"; |
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 it standard to use forward slashes everywhere in the assets file?
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.
yes, they must be forward slashes
The PackageReference check is based on the root project being restored, if this is true all child projects will get it, including packages.config. The goal here is to skip this new behavior for project.json projects. It works the same as before, it was just always adding it and then filtering it out later. Now it only adds it when needed. |
var msbuildFilePathInfo = new FileInfo((string)msbuildPath); | ||
|
||
// Ensure a trailing slash for the relative path helper. | ||
var projectDir = msbuildFilePathInfo.Directory.FullName |
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 have a helper method in PathUtility for this..perhaps use that instead for consistency?
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.
LGTM. Would suggest using PathUtility helper method to ensure trailing slash, but it's up to you.
This change moves the step to add placeholder files for transitive project detection from MSBuild into restore so that it will be applied to all restores. Previously only command line restores were getting this step.
Instead of calling AddPlaceHolderFiles when creating the spec, it will now be done automatically in restore. This gives the same result and makes it less error prone.
✔️ tests already exist for this in nuget.commandline.tests and nuget.command.tests
NuGet/Home#4629