title: Asp.Net Core 2.1: Set partial view default location formats
body: <p>I know it was possible in Asp.Net to se the default location formats for partial views in Global.asax, and I know that in Asp.Net Core it is possible to set the ViewLocationFormats for views similar to this:</p>
  
  <pre><code>        //  services is of type IServiceCollection
          services.AddMvc(options =&gt;
          {
              options.Filters.Add(new AutoValidateAntiforgeryTokenAttribute());
          })
          .SetCompatibilityVersion(CompatibilityVersion.Version_2_1)
          .AddRazorOptions(options =&gt;
          {
              // {0} - Action Name
              // {1} - Controller Name
              // {2} - Area Name
              // Replace normal view entirely
              options.ViewLocationFormats.Clear();
              options.ViewLocationFormats.Add("/Features/{1}/{0}.cshtml"); //Features/{Controller Name}/{Action Name}.cshtml
              options.ViewLocationFormats.Add("/Features/{1}/Views/{0}.cshtml"); //Features/{Controller Name}/Views/{Action Name}.cshtml
              options.ViewLocationFormats.Add("/Features/Shared/{0}.cshtml"); //Features/Shared/{Action Name}.cshtml
              options.ViewLocationFormats.Add("/Features/Shared/Views/{0}.cshtml"); //Features/Shared/Views/{Action Name}.cshtml                
          });
  </code></pre>
  
  <p>For the life of me, I can not figure out how to set the location formats for partial views?</p>
  
  <p>The following portion of code will not work as the Razor engine seems unable to find the partial view:</p>
  
  <pre><code>    public async Task&lt;PartialViewResult&gt; EntityChangeDetailModal(EntityChangeListDto entityChangeListDto)
      {
          var output = await _auditLogAppService.GetEntityPropertyChanges(entityChangeListDto.Id);
  
          var viewModel = new EntityChangeDetailModalViewModel(output, entityChangeListDto);
  
          return PartialView("_EntityChangeDetailModal", viewModel);
      }
  </code></pre>
  
  <p>I know I can explicitly pass in the relative path for the partial view, but I would rather like to be able to just update the default locations so that the Razor engine can resolve these references without me having to make extensive changes to our existing codebase.</p>