Open hosseinitabar opened 2 years ago
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
Try using the GetView
API since you're trying to look it up using a path:
ViewEngine.GetView("", "/Pages/Customer/Information.cshtml", isMainPage: false)
I encountered same problem in a controller which called a view from Razor Class Library. Something like:
return View("_Base_AutoCreate", entity) ;
And I got an exception saying: The view "_Base_AutoCreate" cannot be found. While at the same time, some other views can be found. So I checked the csprj file of the iibrary, there was something like:
<Content Remove="Views\Shared\_Base_AutoCreate.cshtml" />
<Content Remove="Views\Shared\_Base_AutoEdit.cshtml" />
These lines were added automatically. Don't know why, neither when. But after removing them it worked as a charm. Wish this information can be helpful.
Describe the bug
When we use
ViewEngine.FindView(ViewContext, "path/inside/rcl", isMainPage: false)
, we don't get success in spite of view being there.To Reproduce
Link to GitHub minimal working example
Exceptions (if any)
There are no exceptions. It just doesn't work.
Further technical details
dotnet --info
:dotnet --info Output
``` C:\Temp\Git\CheckViewExists>dotnet --info .NET SDK (reflecting any global.json): Version: 5.0.403 Commit: bf9d168ac2 Runtime Environment: OS Name: Windows OS Version: 10.0.19042 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\5.0.403\ Host (useful for support): Version: 5.0.12 Commit: 7211aa01b3 .NET SDKs installed: 3.1.406 [C:\Program Files\dotnet\sdk] 5.0.203 [C:\Program Files\dotnet\sdk] 5.0.403 [C:\Program Files\dotnet\sdk] .NET runtimes installed: Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.21 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.21 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] To install additional .NET runtimes or SDKs: https://aka.ms/dotnet-download ```