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

Add lib placeholder files for Visual Studio restores #1251

Closed
wants to merge 1 commit into from

Conversation

emgarten
Copy link
Member

@emgarten emgarten commented Mar 21, 2017

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

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
@rohit21agrawal
Copy link
Contributor

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";
Copy link
Contributor

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?

Copy link
Member Author

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

@emgarten
Copy link
Member Author

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?

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
Copy link
Contributor

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?

Copy link
Contributor

@rohit21agrawal rohit21agrawal left a 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.

@emgarten emgarten closed this Mar 21, 2017
@emgarten emgarten deleted the dev-emgarten-libAnyForAll branch March 21, 2017 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants