muno92 / resharper_inspectcode

C# static analysis on GitHub Actions.
MIT License
23 stars 19 forks source link

Command "dotnet tool update" fails if root directory contains several projects #482

Open kkostenkov opened 1 month ago

kkostenkov commented 1 month ago

Command dotnet tool update is run as soon as Action starts and due to a very old bug in the tool it fails if the directory contains multiple projects.

In my case this is a game changer because some Unity projects have .sln and .csproj files in the root of the repo.

Maybe the parsing and execution of workingDirectory parameter could be moved to the beginning of the action? Then maybe that parameter could be used as a workaround with the value of ./..

kkostenkov commented 1 month ago

This branch could be used for the repro

muno92 commented 1 month ago

@kkostenkov Sorry for slow responding.

After version 1.11.13, workingDirectory parameter is executed on the begining of the action.

Is your problem is solved?

kkostenkov commented 1 month ago

Thank you so much for the reply. Meanwhile I did the investigation on my own and it appears that the dotnet tool update command is present in two places in the repo. (My lack of knowledge did not allow me to understand why) And the first execution of it comes before the main.ts flow and fails even if I change the working directory.

Yesterday I did another iteration to solve the matter and it appears that those changes help:

  1. Moving workingDirectory parameter parsing
  2. Adding await to process.chdir(workingDir) And the most important
  3. Adding process.chdir(..) to Installer class in index.js . This is the other place of calling dotnet tool update

I personally have no idea why 1 & 2 are needed since I managed to make it work without using workingDirectory parameter in the end, but without those changes the workflow kept failing.

So to answer your question directly: no. Simply moving the execution of workingDirectory parameter won't help to solve the issue.