Skip to content

paket.targets per package #417

Closed
Closed

Description

@ctaggart

When I adopted Paket, I was expecting paket.targets files per NuGet package to soon happen. It was mentioned before in #197. I'd really like to see this happen. Something like this:

<Import Project="..\..\..\packages\FSharp.Core\paket.targets" Condition="..\..\..\packages\FSharp.Core\paket.targets" />
<Import Project="..\..\..\packages\Newtonsoft.Json\paket.targets" Condition="..\..\..\packages\Newtonsoft.Json\paket.targets" />

There are way to many changes being made to the project files and this causes lots of noise in the diff and some frustration when merging. An example is this pull request I just made for FAKE: fsprojects/FAKE#602

Activity

  1. forki commented on Dec 4, 2014

    @forki
    Member

    I know that this is a requested feature and I already started working on it. But it's not an easy one.

    Regarding the FAKE changes. That's not that bad. The real issue was that I didn't make that Paket 0.17 transition before, so that you had both, the improved Paket output and your FSharp.Core changes in one Commit. But it's still good progress:

    image

  2. forki commented on Dec 9, 2014

    @forki
    Member

    sneak peek for v0.19:

    image

  3. isaacabraham commented on Dec 9, 2014

    @isaacabraham
    Contributor

    awesome

  4. ctaggart commented on Dec 9, 2014

    @ctaggart
    ContributorAuthor

    That is so beautiful!

    You may wish to stick with lowercase paket.targets instead of Paket.targets since all the other files are lowercase. Since they are auto-generated, it doesn't matter much to me. May be that actually helps differentiate it from the other paket.targets used for msbuild targets.

  5. panesofglass commented on Dec 9, 2014

    @panesofglass
    Contributor

    Lovely! Does this mean packages need to publish paket.targets files?

  6. ctaggart commented on Dec 9, 2014

    @ctaggart
    ContributorAuthor

    No, they get generated by Paket when it unzips the nupkg.

  7. forki commented on Dec 10, 2014

    @forki
    Member

    how about generated.paket.targets this will make it easy to find?

  8. forki commented on Dec 10, 2014

    @forki
    Member

    There is still one issue left:

    We can't create the targets files per package since we have to create different When clauses if the csproj file already contains the same framework assemblies.

    So we have two options:

    1. Create a targets file per package and project and put it under packages
      • How can we create a good naming pattern to match projects and targets files?
    2. Create a targets file per project (which contains all packages) and put it next to the project.
      • If the project is call MyProject.csproj we could call these MyProject.paket.targets
      • One could gitignore all *.paket.targets

    What do you guys think?

    /cc @agross @mexx

  9. TWith2Sugars commented on Dec 10, 2014

    @TWith2Sugars
    Contributor

    I'd prefer option 1 with MyProject.paket.targets

  10. forki commented on Dec 10, 2014

    @forki
    Member

    that wouldn't work since in one repository can be man MyProject.csproj files in different folders.

  11. agross commented on Dec 10, 2014

    @agross
    Contributor

    If we go for option 1 we should regenerate the project structure and put the targets there.

  12. agross commented on Dec 10, 2014

    @agross
    Contributor
    packages/Foo
    packages/targets/src/Bar/Bar.csproj.paket.targets
    src/Bar/Bar.csproj
    src/Bar/paket.references
    
  13. 32 remaining items

  14. agross commented on Dec 10, 2014

    @agross
    Contributor

    @Uli-Armbruster also wouldn't be pleased to learn that automatic restore in VS was discontinued.

  15. forki commented on Dec 10, 2014

    @forki
    Member

    Ok I think there is no good solution to this. I propose the following:

    • we add the targets feature
    • people who want to use VS restore have to commit the targets file for now
    • people who trust their build.cmd can gitignore the file

    This is far from perfect, but even for the autorestore people this might be a small benefit since they know they can nuke the targets file if a merge error occurs.

    We will look for better solutions. Maybe we can talk to @jeffhandley and propose to open up the nuget addin.

    What do you think?

  16. TWith2Sugars commented on Dec 10, 2014

    @TWith2Sugars
    Contributor

    Sounds like a reasonable workaround

  17. jeffhandley commented on Dec 10, 2014

    @jeffhandley

    As was pointed out, these problems are precisely why we ditched msbuild-integrated restore. Within VS, our extension hooks into the SolutionBuild event and executes restore BEFORE VS launches msbuild. Outside VS, it requires that build scripts run nuget.exe restore. That achieved the results that we wanted: no-touch restore in VS, but very scriptable outside VS. It's worked out great.

  18. forki commented on Dec 10, 2014

    @forki
    Member

    @jeffhandley we know that. The only issue for paket is: we are not in the
    Visual Studio box and I don't see a good chance to get in.
    On Dec 10, 2014 9:25 PM, "Jeff Handley" [email protected] wrote:

    As was pointed out, these problems are precisely why we ditched
    msbuild-integrated restore. Within VS, our extension hooks into the
    SolutionBuild event and executes restore BEFORE VS launches msbuild.
    Outside VS, it requires that build scripts run nuget.exe restore. That
    achieved the results that we wanted: no-touch restore in VS, but very
    scriptable outside VS. It's worked out great.

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

  19. isaacabraham commented on Dec 11, 2014

    @isaacabraham
    Contributor

    @ovatsus why is an extension such a bad thing? there's a plug-in for nuget, there could (should?) be one for paket as well. In addition to doing the Nuget-esque pre-build steps, it could do other things as well such as integrated ability to modify paket via a GUI integrated into VS rather than having to fall back to the command line (or fsx).

  20. ovatsus commented on Dec 11, 2014

    @ovatsus

    I'm not saying the extension is a bad thing, would be great to have the extension. What I'm saying is that I want all my projects to be able to just work by a simple git clone + open the .sln and build, without any special requirements.

  21. forki commented on Dec 11, 2014

    @forki
    Member

    Yes we all want this. But MS closed the door for us. Instead of fixing the
    root cause they shipped an addin. Btw: this is not only bad for us it's
    also a really bad solution for other IDEs. Simply calling MSBuild doesn't
    work anymore - so every other IDE has to build a plug-in.

    Now we have to find the best workaround.
    On Dec 11, 2014 11:26 AM, "Gustavo Guerra" [email protected]
    wrote:

    I'm not saying the extension is a bad thing, would be great to have the
    extension. What I'm saying is that I want all my projects to be able to
    just work by a simple git clone + open the .sln and build, without any
    special requirements.

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

  22. ovatsus commented on Dec 11, 2014

    @ovatsus

    Well, right now, if you don't change anything, restore is working, so Paket even has that as added benefit on top of Nuget, it will work fine on other IDEs

  23. isaacabraham commented on Dec 11, 2014

    @isaacabraham
    Contributor

    @ovatsus but Nuget takes this approach via an addin - out of the box VS won't restore conventional NuGet packages either.

  24. forki commented on Dec 11, 2014

    @forki
    Member

    I might have found a (hacky) way. Stay tuned.

  25. isaacabraham commented on Dec 11, 2014

    @isaacabraham
    Contributor

  26. ctaggart commented on Nov 11, 2015

    @ctaggart
    ContributorAuthor

    I'm closing this because the new MSBuild world moves dependencies to an external project.lock.json that should be .gitignored which solves this issue and also my biggest grievance. Adding support for project.lock.json is in #736.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions