Skip to content

paket update slow with empty paket.references files #3000

Closed

Description

@stackh34p

Description

This is a quite specific to my own use-case request that should be rather seen as a potential improvement.

I have a C# project folder with a number of .csproj files inside. I am using paket to manage my dependencies for those projects -- I can have separate dependencies per project because I can have a ProjectName.csproj.paket.references file for each project. I also have a global paket.references file. However, I want some projects to be totally ignored by paket because it wastes too much time hanling them, even if there is nothing to be installed as a dependency. So far I am trying to use an empty paket.references file per such project, but regardless of that, it takes a somewhat significant amount of time for Paket to realize there is nothing to do with that project. As these projects are about 5-6 or more, the paket update command takes quite a long time to complete.
It would be useful to know if there is a way to make Paket ignore certain projects in the given setup. I know that most people would advice me to change my project file organization, but I cannot because tools like the Unity engine create a bunch of .csproj files in the working directory which is nothing I can help with. Furthermore, for me wanting to create a package of the unity project contents, I must as well place the packaging project along, therefore increasing the number of projects paket needs to loop trough.

Repro steps

The issue is reproducible with Paket version 5.131.x (the latest released version up to this date).

  1. Create a directory and make a number of csproj files there. You could create a single C# project and replicate the .csproj file a number of times, to make them at least 8.

  2. Define a paket.dependencies file

  3. Create a paket.references file per project. The references file can be empty. There should also be a global paket.references file

  4. Add paket to the project directory

  5. Run paket update command from a terminal within the project directory

Expected behavior

I'd expect the project with empty paket references file to be processed quite faster, or to have a way to tell paket not to process them

Actual behavior

It takes quite a while for paket to handle each project

Known workarounds

None I know of.

Activity

  1. forki commented on Jan 19, 2018

    @forki
    Member
  2. stackh34p commented on Jan 19, 2018

    @stackh34p
    Author

    I hope a git repo would do as well. I have made an example with the simplest setup I could think of which illustrates the problem. I have made 2 folders with nearly none and with a few empty paket.references files, thus illustrating the slowdown.

    In this example, we have a minor slowdown for about 11 seconds for having 8 empty paket.references files. The more they become, the slower the processing. If we use multiple times the paket update command to individually address different dependency groups, the slowdown would be sensed even further.

    The project readme has some instructons on how to test this, no need for visual studio, just a bash terminal could do.

  3. enricosada commented on Jan 24, 2018

    @enricosada
    Contributor

    Closing. Dupe of #2054

  4. changed the title [-]How should I tell paket to skip certain projects when there are more than one in a single folder?[/-] [+]paket update slow with empty `paket.references` files[/+] on Jan 24, 2018
  5. enricosada commented on Jan 24, 2018

    @enricosada
    Contributor

    Reopen for the performance issue of empty paket.references

    The ignore of path is tracked in #2054

  6. forki commented on Feb 12, 2018

    @forki
    Member

    ok took a look at this. the problem is that paket still thinks it needs to maintain the csproj. So it will parse it and try to remove paket references from ealier runs.
    Just think about the case when you have a package in the references file and then remove it. Paket needs to remove it from the csproj as well.

  7. stackh34p commented on Feb 12, 2018

    @stackh34p
    Author

    @forki I see. Maybe this request is not correctly addressed as a paket concern, and maybe it is a very specific case of my own. It would be better if paket is able to properly maintain the package dependencies and without it processing the project one may experience some strange issues -- like what one happened to me once when I merged a project from version control and the merged version referred to non-existent packages.... Using paket restore would fix that if it works like it does now, thus I have an idea of how it could get wrong if the paket update/restore commands do not do their job properly.

    Anyway, I have devised a workaround for my case, it is quite neat if you're using bash or git bash:

    # trick paket to not update all projects
    for csproj in $(ls *.csproj); do
      eval "mv -f $csproj $csproj.paketignore";
      echo "Temporarily renamed $csproj to $csproj.paketignore";
    done
    mv -f ProjectIWantToUpdate.csproj.paketignore ProjectIWantToUpdate.csproj
    
    paket update
    
    # undo above renamimg
    for csproj in $(ls *.csproj.paketignore); do
      eval "mv -f $csproj ${csproj%.*}";
      echo "Renamed $csproj back to ${csproj%.*}";
    done
    

    So. with the above approach in mind and the argumentation for the importance of the current behavior, I feel fine to close this issue.

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