ASP.NET Scaffolding: View from Controller action method
In Visual Studio 2022, I can right click on an action method in a controller (eg. ProductController) to select Add View, Razor View and then Add.
From there I can then select List under Template and my domain model under Model class. The view will then be created under “Views/Product”
I would like to do the same using Rider. The closest I got was to create the Product folder under Views, right click on the folder, Add, Scaffolded Item… MVC View. From here I can select the List template and my model class, but I must supply a data context class for the Add button to be enabled.
Is there a way to achieve the same result as when using Visual Studio 2022?
JetBrains Rider 2025.2 RC 1
Build #RD-252.23892.317, built on July 24, 2025
Source revision: 6365dcd10dfe7
Runtime version: 21.0.7+6-b1038.58 aarch64 (JCEF 122.1.9)
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.lwawt.macosx.LWCToolkit
macOS 14.7.6
.NET Core v8.0.11 ARM64 (Server GC)
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Please sign in to leave a comment.
In the terminal, I can run the following command to generate the Index.cshtml file:
dotnet aspnet-codegenerator view Index List -m Product -outDir Views/ProductHello Pkruger,
Thank you for contacting JetBrains Support. I'm glad to work with you on this ticket.
The closest functionality in Rider is put caret in “View” method => press ALT + Enter to open context menu => Choose “Create Razor views”, as below:
Reference
ASP.NET Scaffolding | JetBrains Rider Documentation
Thanks,
Tom
thank you Tom Luo
Unfortunately, when I do this on my M1 Mac it does not work. I only get the following:
Thank you!
My setup:
JetBrains Rider 2025.2
Build #RD-252.23892.524, built on August 12, 2025
Source revision: 18364647ddbb4
Subscription is active until April 10, 2026.
For educational use only.
Runtime version: 21.0.7+6-b1038.58 aarch64 (JCEF 122.1.9)
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.lwawt.macosx.LWCToolkit
macOS 14.7.6
.NET Core v8.0.11 ARM64 (Server GC)
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 1536M
Cores: 8
Metal Rendering is ON
Registry:
documentation.show.toolbar=true
ide.lookup.shrink=true
ide.experimental.ui=true
llm.show.ai.promotion.window.on.start=false
Non-Bundled Plugins:
com.intellij.plugins.visualstudioformackeymap (252.23892.201)
avalonia-rider (1.6.0.281)
com.intellij.plugins.macoskeymap (252.16512.17)
com.intellij.ml.llm (252.23892.530)
Hello,
This happens when the view already exists. Could you check whether the view exists? You can confirm this by putting caret in view method, then hovering your mouse on it:
If no view exists but the issue persists, please go to Settings | Editor | Inspection Settings | Inspection Severity | ASP.NET, check if Unknown view inspection rule is enabled:
If the configuraiton is correct, please share the following with us to investigate this further:
.editorconfigfile if it exists.You can upload these files to our Upload Service and provide us with the Upload ID.
Thanks,
Tom
Hello Tom Luo
Thank you for your reply. Before I saw and then read your reply, I noticed there was an update available for Rider. I updated to JetBrains Rider 2025.2.0.1, saw your post, and now I do get the “Create Razor views” option.
Just to confirm, the code generated by these options are not the same as those generated by
dotnet aspnet-codegenerator view Index List -m Product -outDir Views/ProductThe Views generated by the “Create Razor views” options are just the bare minimum, with no Model code?
Thank you!
Hello,
Yes, this approach is designed to generate a minimal view by default. If you would like to include Model code in your implementation, you can right-click view folder | Add | Scaffolded item, then specify model from there.
Important Note:
Currently, there is a known issue (RIDER-88316 Error when creating scaffolded api controller) where scaffold generation fails on macOS. This limitation does not affect Windows users.
Let me know if you have any further questions.