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

Implement package auto-restore for .csproj projects #747

Merged
merged 5 commits into from
Feb 4, 2017

Conversation

DustinCampbell
Copy link
Contributor

@DustinCampbell DustinCampbell commented Feb 3, 2017

IEnumerable<PackageReference> unresolvedPackageReferences;

// Did the project file change? Diff the package references and see if there are unresolved dependencies.
if (previousProjectFileInfo != null)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be really good if NuGet.ProjectModel provided some API for these types of checks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which checks? These are the package references defined in the .csproj. NuGet provides no APIs for the .csproj file itself.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, there is no API in nuget for reading package references from csproj? I didn't realize that
(there used to be APIs for reading references from packages.config and to read references from project.json)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope. The API for reading from .csproj is MSBuild. 😄


namespace OmniSharp.MSBuild.ProjectFile
{
public class PackageReference : IEquatable<PackageReference>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly. I believe these are used by NuGet to handle VS package restore, which is a much bigger thing than what we're doing. I just need to keep a list of the PackageReferences items computed by MSBuild so that I can tell if changes occurred to the project file. This is before NuGet is really involved.

Note that this class is not exactly the same. It has at least one piece of additional metadata that is provided via MSBuild targets.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right now I remember, in the past I used to define my own PackageReference on the old nuget apis too, for the very same reason you just mentioned

@DustinCampbell DustinCampbell merged commit 0c6d19e into OmniSharp:dev Feb 4, 2017
@DustinCampbell DustinCampbell deleted the package-restore branch February 8, 2017 01:26
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.

2 participants