Rider do not analyze code, for Packages folder (embedded packages)

Hey, I was trying to learn creating custom packages, and I moved my code from Assets folder to Packages folder. After this transfer, I realized that Rider is not analyzing the code.

9761956--1398187--upload_2024-4-10_15-11-49.png

Even if I try to enable the highlight, it just shown lots of error, as cannot resolve Unity

9761956--1398190--upload_2024-4-10_15-12-45.png

The fact that, in my other Unity project, I set analyzing on, in my other Unity project but ah… I don’t remember how I achieved that. So what’s the solution for this?

Also as shown, CircularUI (which is the code that I’m working on) inside of the packages folder
9761956--1398193--upload_2024-4-10_15-14-29.png

In project settings or preferences find either the external editor section and tick the checkbox for packages. Or perhaps simply recreate the csproj files and restart rider.

3 Likes

Now I enabled all boxes but still in same situation, also I believe I should only tick embedded packages box. And I regenerated project files, but still rider not analyzing the code in Packages folder.
9762007--1398205--upload_2024-4-10_15-40-24.png

2 Likes

The package compiles in Unity without errors? And its listed in Unity under Packages respectively Package Manager?

If it’s an embedded package (located under PackageCache) move it to its own folder separate from the project and pick the “add from disk” option. That way you can use it in multiple project and put it under source control. Not sure if this changes the behaviour though, but that’s the recommended workflow.

Manually deleting the .csproj and .sln as well as the .idea folder might also help.

Yes there are no compilation error. I can not add the project from disk, because I still work on the project, if I add it this way some of the assets will be not editable, however even when I add the package this way, still analyzing is disabled.

I’m not home right now, tonight I will try to copy the .idea folder of the project which aı telled that in other project analyze works, so if it related with rider settings it may work.

And for removing .csproj and .sln, I haven’t tried .sln, but not working for .csproj.

How come?
“by disk” packages are not read-only and if you can’t select the assets in the package you only need to change the package visibility (select package.json in project view, visibility is a dropdown in Inspector)

I wouldn’t copy the .idea folder from elsewhere, this contains project specific settings. Backup the folder and delete it, let Rider recreate it, and if that doesn’t fix it close Rider again and restore the previous .idea folder so you don’t lose any settings.

I do remember having had the occassional issue like yours but it was usually only a single file, not an entire project. Haven’t had this issue for a while, definitely not in 2023.3 and it was always fixed either by restarting Rider or re-enabling the anaylsis setting.

Perhaps there is a setting that turns off analysis completely for a given .csproj? Did you try clicking the “OFF” label in your first screenshot?

Hey! Try to follow the following steps:

  1. set the default settings
  2. Close Unity
  3. Remove all csproj, sln files
  4. Make sure your package is in the Packages folder
  5. Start Unity, call Assets->Open CSharp projects
    Rider should start with the solution
  6. You may switch to the Solution view instead of Unity view. Check that project for your package is generated.
    9762241--1398262--upload_2024-4-10_16-31-30.png


God! I finally solved the issue, I thank you both for helping. The problem caused because I didn’t create assembly definition for my code. Ahh it’s a silly mistake…