Skip to content

Using Paket with Shared projects - referencing different package versions from different projects #405

Closed

Description

@hmemcpy

I'm trying to use Paket on a project (a R# plugin) which uses Shared projects, and duplicated .csproj/packages.config files for referencing different R# SDK versions.

An example of such structure is:

/MyPlugin.sln
/MyPlugin.Domain/MyPlugin.Domain.8.2.csproj
/MyPlugin.Domain/MyPlugin.Domain.9.0.csproj
/MyPlugin.Domain/packages.MyPlugin.Domain.8.2.config // <-- NuGet-supported packages.config format
/MyPlugin.Domain/packages.MyPlugin.Domain.9.0.config
...

etc.

The packages.*.config contains a reference to a particular version of ReSharper SDK, either 8.2 or 9.0. NuGet is smart enough to update the relevant csproj file.
I'm using this to avoid #if/#else hell in my project, so I'm using partial classes to accommodate for the differences in the API.

I want to migrate this structure to Paket.
Couple of questions:

  1. Can I even do this? Can Paket support different packet.dependencies in the same directory?
  2. Same question about paket.references - how do I add a reference to a different version of the SDK in different projects?
  3. Where do I put those files? Per-project? At solution level?

Thanks!

Activity

  1. agross commented on Nov 29, 2014

    @agross
    Contributor

    Hi Igal,

    I know where you're coming from ;-)

    Paket currently supports only one version per dependency. For the ReSharper SDK that basically means that by default you would have to compile against a single SDK.

    /versions/8.0/paket.dependencies
    /versions/8.0/paket.lock
    /versions/8.0/paket.references
    /versions/8.0/packages/ReSharper.SDK
    /versions/8.0/Foo.csproj
    /versions/9.0/paket.dependencies
    /versions/9.0/paket.lock
    /versions/8.0/paket.references
    /versions/9.0/packages/ReSharper.SDK
    /versions/9.0/Foo.csproj
    /src/Foo/Plugin.cs
    

    While the solution is not perfect (as you currently cannot override the dependency file name), you would have to have a folder per ReSharper SDK version with a dependencies file in each. Your projetcs would all have to link its source files from /src or their partials under /versions.

    That would give you a dependency tree per SDK version. Updates of other dependencies would become cumbersome as you would have to repeat the update process for each of your SDK version roots.

  2. hmemcpy commented on Nov 29, 2014

    @hmemcpy
    Author

    Hey Alex :)

    Yes, also chatting with @forki, he made the same suggestion.

    Possibly I'll just leave 8.2 as it is, and use Paket for 9.0... the difference is that R# team decided to split up the SDK into several packages, and it creates a nuget mess :(

    (I only added the highlighted one)

  3. agross commented on Nov 29, 2014

    @agross
    Contributor

    As a suggestion, if we

    • allow to use specify the dependencies file name and also
    • allow includes for the dependencies file and
    • write different lockfiles

    ... it might as well just work. Wondering what @forki thinks about this. Sounds like a lot of complexity.

  4. forki commented on Nov 29, 2014

    @forki
    Member

    At the moment I think we should not do this. But this feature will come at
    some point in the future.
    On Nov 29, 2014 6:16 PM, "Alexander Groß" [email protected] wrote:

    As a suggestion, if we

    • allow to use specify the dependencies file name and also
    • allow includes for the dependencies file and
    • write different lockfiles

    ... it might as well just work. Wondering what @forki
    https://github.com/forki thinks about this. Sounds like a lot of
    complexity.

    —
    Reply to this email directly or view it on GitHub
    #405 (comment).

  5. hmemcpy commented on Nov 29, 2014

    @hmemcpy
    Author

    In the meantime, I'm going to try your suggestion using version directories (can't be less painful than having separate .csproj/package.config files).

    Can Paket do nested .dependencies?

    I want to place all the .csproj files into their own directory, e.g.

    /versions/8.2/proj1/proj1.csproj
    /versions/8.2/proj2/proj2.csproj
    /versions/8.2/tests/tests.csproj
    

    so that I could place a "main" paket.dependencies file (containing the SDK only) in the /versions/8.2 root, and have an additional one under /versions/8.2/tests/ that has the "SDK.Tests" package:

    /versions/8.2/paket.dependencies/references
    /versions/8.2/proj1/proj1.csproj
    /versions/8.2/tests/paket.dependencies/references
    

    etc?

  6. forki commented on Apr 6, 2016

    @forki
    Member

    I think this can be done with groups since v2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions