I have a NuGet package hosted on a GitHub Package Repository which contains a
.ruleset file, and code style settings contained in a
.json file. This is so I can share style settings and code analysis across multiple solutions.
When restoring this package on my dev machine, the package is correctly restored, and my IDEs (Visual Studio and Rider), correctly pick up the new style settings.
However, when attempting to build dependant projects in GitHub Actions, many errors are thrown, saying the
.json files cannot be found.
I do not get this error when running the same build and restore commands on my Windows, or Mac OS machines.
Has anyone else experienced issues like this with GitHub Actions and Packages?
For anyone else who encounters this issue, I’ve actually narrowed it down to an issue with the .NET Core SDK on Ubuntu. I spun up a VM with the latest version of Ubuntu and found the same issues!
This problem seems is caused by the path of the rule set file you set to reference in the .csproj file, you may use an absolute path with $(SolutionDir). If so, you can try using a relative path, or using $(ProjectDir) instead of $(SolutionDir).
The following are two tickets reported the similar problems, you can reference them:
MSB3884: Could not find rule set file
warning MSB3884: Could not find rule set file
@brightran , just gave that a try, sadly it didn’t make a difference. I can only seem to get it working on Windows and MacOS. Building with any of the Ubuntu instances results in this issue.
According to the error messages, obviously the file path is changed and correct. It seems that the " repositoryPath" has been changed in the configuration.
If possible, please share your repository with us, so that we can check more detailed configuration settings about the NuGet packages and the workflow to analyze the root cause.
In addition, you said
I can only seem to get it working on Windows and MacOS. Building with any of the Ubuntu instances results in this issue.
You tested on you local Windows and macOS machines, right? could you please also try on the GitHub-hosted Windows runner and GitHub-hosted macOS runner to see if it can woek fine?