title: Unable to find view Razor .Net Core app
body: <p>I am using Razor outside MVC.  I would like to render view as string. Here is my method:</p>
  
  <pre><code>    public async Task&lt;string&gt; RenderToStringAsync(string viewName, object model)
      {            
          var httpContext = new DefaultHttpContext { RequestServices = _serviceProvider };
          var actionContext = new ActionContext(httpContext, new RouteData(), new ActionDescriptor());
  
          using (var sw = new StringWriter())
          {
              var viewResult = _viewEngine.FindView(actionContext, viewName, false);
              if (viewResult.View == null)
              {
                  throw new ArgumentNullException($"{viewName} does not match any available view");
              }
  
              var viewDictionary = new ViewDataDictionary(new EmptyModelMetadataProvider(), new ModelStateDictionary())
              {
                  Model = model
              };
  
              var viewContext = new ViewContext(
                  actionContext,
                  viewResult.View,
                  viewDictionary,
                  new TempDataDictionary(actionContext.HttpContext, _tempDataProvider),
                  sw,
                  new HtmlHelperOptions()
              );
  
              await viewResult.View.RenderAsync(viewContext);
              return sw.ToString();
          }
      }
  </code></pre>
  
  <p>I've created Views folder and pasted there few views. All the files has Copy to Output Directory - Copy always. But I am getting next  here</p>
  
  <pre><code>  var viewResult = _viewEngine.FindView(actionContext, viewName, false);
  </code></pre>
  
  <p>viewResult has property Success which is always false and also has property SearchedLocations with values: "/Views/Shared/Email.cshtml" and "/Views//Email.cshtml". Any ideas ?</p>