MVC view path from VisualStudio fails

When I right click on my view file (RetrieveReport.cshtml) and select "Properties" I find the "Browse to URL" property has this value: "~/Reports/HtmlReport/RetrieveReport"

Then when I try to do this in my controller:

return View("~/Reports/HtmlReport/RetrieveReport");

I get:

The view '~/Reports/HtmlReport/RetrieveReport' or its master was not found or no view engine supports the searched locations. The following locations were searched: ~/Reports/HtmlReport/RetrieveReport

That seems messed up since that is verbatim what VisualStudio told me to put in there!

I tried returning views with all of these paths:

~/Reports/HtmlReport/RetrieveReport.cshtml HtmlReport/RetrieveReport /Reports/HtmlReport/RetrieveReport Reports/HtmlReport/RetrieveReport RetrieveReport

None of them succeed. I thought at one point RetrieveReport was working, but now it seems to not be working.

In case it helps at all, the location on the file system is:


In my solution explorer the file is at:

Areas -> Reports -> Views -> HtmlReport -> RetrieveReport.cshtml


After seeing this work elsewhere in our codebase this worked for me:


Still don't know why VisualStudio was pointing to a dead end ...

Need Your Help

converting value types of an object to Dictionary<string, string>

c# .net linq c#-4.0 reflection

How do I iterate through all the value types of an object and convert that into a Dictionary? I was heading the reflection way