# Best practice: how to add optional Rider support in gradle build

**URL:** <https://platform.jetbrains.com/t/best-practice-how-to-add-optional-rider-support-in-gradle-build/4540>\
**Category:** IntelliJ Platform\
**Created:** [June 24, 2026, 2:17pm UTC](https://platform.jetbrains.com/t/best-practice-how-to-add-optional-rider-support-in-gradle-build/4540 "2026-06-24T14:17:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonathanlermitage.1](https://avatars.discourse-cdn.com/v4/letter/j/e480ec/32.png) [@jonathanlermitage.1](https://platform.jetbrains.com/u/jonathanlermitage.1)\
**Post date:** [June 24, 2026, 2:17pm UTC](https://platform.jetbrains.com/t/best-practice-how-to-add-optional-rider-support-in-gradle-build/4540/1 "2026-06-24T14:17:35Z")

</div>

Hi,  
I have a plugin that’s compatible with all IDEs, but I need to add some code just for Rider.

Context: I need to open projects programmatically (basically, I have a Favorite Projects manager). I do that via `ProjectManager.getInstance().loadAndOpenProject(projectPath)`. It works on all IDEs, except in Rider. I opened [RIDER-139440](https://youtrack.jetbrains.com/issue/RIDER-139440/ProjectManager.loadAndOpenProject-doesnt-work-in-Rider), but I need a (temporary) workaround asap. I found how Rider actually opens projects, and it’s using APIs that are specific to Rider.  
So, I will add some optional code just for this IDE.

Let’s say I’m using the official [intellij-platform-plugin-template](https://github.com/JetBrains/intellij-platform-plugin-template/). I support 251+ IDEs, but I can change it if needed. I don’t support the split mode for now.  
I know what to do in `plugin.xml`: something like `<depends optional="true" config-file="plugin-rider.xml">com.intellij.modules.rider</depends>`.  
 → I would need some advice for my `build.gradle.kts`. I could build against Rider (`intellijPlatform { create("RD", ...)}`), but I would like to continue to work with IJ.  
I think a solution would be to create a gradle module for Rider.

I’d like to know your opinion before moving forward. Thx.

---

<div class="post-metadata">

**Author:** ![Ivan.Migalev](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/ivan.migalev/32/355_2.png) [@Ivan.Migalev](https://platform.jetbrains.com/u/Ivan.Migalev)\
**Post date:** [June 24, 2026, 10:42pm UTC](https://platform.jetbrains.com/t/best-practice-how-to-add-optional-rider-support-in-gradle-build/4540/3 "2026-06-24T22:42:31Z")

</div>

Try using `com.intellij.ide.impl.ProjectUtil#openOrImportAsync` — that method is Rider-friendly, and I think is compatible with all the other IDEs as well, so you won’t need a Rider-specific module.

If you still need a Rider-specific module for some reason, though, then my recommendation would be to use plugin modules.

Check [here](https://github.com/JetBrains/intellij-platform-modular-plugin-template) how to create a modular plugin — each of the modules can have a separate dependencies set, and even depend on different IDEs. When loading the plugin, only the modules whose dependencies are satisfied will be loaded. This allows you to pack IDE-specific modules into the same plugin with essentially no downsides.

Note that **most likely you won’t need it** and `ProjectUtil` will resolve the issue.

---

<div class="post-metadata">

**Author:** ![jonathanlermitage.1](https://avatars.discourse-cdn.com/v4/letter/j/e480ec/32.png) [@jonathanlermitage.1](https://platform.jetbrains.com/u/jonathanlermitage.1)\
**Post date:** [June 24, 2026, 11:54pm UTC](https://platform.jetbrains.com/t/best-practice-how-to-add-optional-rider-support-in-gradle-build/4540/4 "2026-06-24T23:54:00Z")

</div>

It’s like I cannot use it from Java, probably because this is a suspended function. I tested `openOrImport` instead, and it works. In Rider, it asks whether to open as a simple folder or select the `.sln` file, but that’s okay. In IJ, it opens the project directly.  
Thank you!

[edit] Is it better if I use the path of the `.sln` file directly.
