Rider ASP Build-Issues (Linux)
ASP – Build Differences Compared to the CLI
Rider ASP Build-Issues (Linux). Since first starting with Rider there has been an issue which has plagued me. Building web-apps in Rider sometimes give different behaviour compared to building them using the CLI (command-line interface). It is also worth noting that this issue does not seem to affect all systems. However, I have now experienced this through three versions of Ubuntu and multiple versions of Rider. Jetbrains support has thus far been responsive but not offered any solutions.
At the time of writing the version of Rider used was 20.3.2 and the operating system Ubuntu 20.04.
Page not found (404) with a default web-app.
When creating a default web application gives page is not found (404) when building with Rider. Surprisingly, this is true with and without Re-Sharper enabled in the build settings. Consequently, the same result is seen is both scenarios.
Create A Default Web Application

Build Using Default Settings (Re-Sharper Enabled)

Build Using Rider with Re-Sharper Disabled

Build Using the CLI

Page not found – Workarounds – Rider ASP Build-Issues (Linux)
Workaround 1. Build using the command line and attach the debugger separately
Rider Attach Debugger 1 Rider Attach Debugger 2
Workaround 2. Setup Razor Runtime Compilation
- Add Nuget Package: Microsoft.AspNetCore.Mvc.RazorRuntimeCompilation
- Add an extra line to launchSettings.Json (Properties folder)

Add:
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation"
{ "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { "applicationUrl": "http://localhost:19595", "sslPort": 44314 } }, "profiles": { "IIS Express": { "commandName": "IISExpress", "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } }, "Website": { "commandName": "Project", "dotnetRunMessages": "true", "launchBrowser": true, "applicationUrl": "https://localhost:5001;http://localhost:5000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development", "ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" } } } }
Another Oddity – The library ‘libhostpolicy.so’ not found.
After setting up Razor run time compilation as described above, if the application has never been built using the command line it will now launch correctly. However, if the application has already been built using the command line it will fail; saying The library ‘libhostpolicy.so’ is not found.

To fix this, clean and then rebuild the solution. Both options are in the Build menu.

Models Not Found after Scaffolding 2 Factor Authentication – Rider ASP Build-Issues (Linux)
For full details on the process to reach this point is found in these two articles:


Models Not Found after Scaffolding 2 Factor Authentication – Workaround
Build using the command line and attach the debugger separately.