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

Adds related features for working with the packages.config file #30

Merged
merged 4 commits into from Aug 22, 2021

Conversation

3F
Copy link
Owner

@3F 3F commented Jul 9, 2020

Closes #28
Related #27

This also will add support for GetNuTool compatible packages

In particular, the following format https://github.com/3F/GetNuTool#format-of-packages-list

Not yet implemented.
Currently, I think IPackagesConfig and IPackageInfo fully represents design of the future logic.

@3F 3F added the enhancement label Jul 9, 2020
@3F 3F added this to the 2.6 milestone Jul 9, 2020
@3F
Copy link
Owner Author

3F commented Jul 9, 2020

/// Package cannot be added if the same <see cref="IPackageInfo.Id"/> is already exists in active storage.

Because, for example, VS 16.6.3 can't process the following:

  <package id="ILAsm" version="4.700.1" />
  <package id="ILAsm" version="4.700.2" />

Either fails for opening manager in IDE or even crashed menu item :)

Therefore, any possible adding should be considered as /no more than one/ for the same id.

@3F 3F force-pushed the dev/feature/packages.config branch from bc0bfb1 to f858ede Compare August 11, 2021 18:05
@3F
Copy link
Owner Author

3F commented Aug 11, 2021

Rebased onto f5374f8

@3F
Copy link
Owner Author

3F commented Aug 11, 2021

Finally pushed some implementation (based on my #27 (comment))

A small changes to the original design:

Removed methods:

- IPackagesConfig.LoadOrNew()
- IPackagesConfig.Load()

PackagesConfigOptions was introduced instead.

Added:

+ IPackageInfo.Remove() - actually just for the convenience. Will be invoked IPackagesConfig.Remove() related method.
+ IPackageInfo.VersionParsed - same, For the better performance it will be initialized only on the first access. Thread-safe.

Not yet fully tested. Need to cover the remaining parts. Play before merge!

@3F 3F changed the title WIP. Adds related features for work with packages.config file Adds related features for working with the packages.config file Aug 22, 2021
@3F 3F merged commit ef21d5d into master Aug 22, 2021
@3F 3F deleted the dev/feature/packages.config branch August 22, 2021 14:57
3F added a commit that referenced this pull request Aug 23, 2021
* FIXED: Fixed CalculateHashCode() Extension.
         Internally affects many objects due to broken GetHashCode().

* FIXED: Fixed SlnItems.ProjectDependenciesXml when empty input:
         Report #25 (comment)

* NEW: packages.config support PR #30. Related issues #27, #28.
       To activate it, use the following flags:
        * PackagesConfig, PackagesConfigSolution, PackagesConfigLegacy.

        For example,
        ```
        using Sln l = new("Input.sln", SlnItems.AllNoLoad | SlnItems.PackagesConfig);

        IPackageInfo found = l.Result.PackagesConfigs
                                        .SelectMany(s => s.Packages)
                                        .FirstOrDefault(p => p.Id.StartsWith("Microsoft."));
        // found.MetaTFM ...

        Version v = l.Result.PackagesConfigs.First().GetPackage("LX4Cnh")?.VersionParsed;
        ```
          Including GetNuTool compatible packages, format:
          https://github.com/3F/GetNuTool#format-of-packages-list

* NEW: Added HasValue and HasNothing properties in PropertyItem.

* NEW: Added SlnItems.AllMinimal and SlnItems.AllNoLoad in addition to SlnItems.All.

* NEW: Added IXProject.GetPackageReferences().

* CHANGED: ConfigItem.Format() marked as obsolete.
           Use `ToString()` and `IConfPlatform.Formatted` instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

packages.config support
1 participant