title: Generated Razor view file does not recognise the model class
body: <p>As I build and run (<code>dotnet run</code>) my ASP.NET Core MVC project using VS Code, I get the following two error messages:</p>
  
  <blockquote>
    <p>obj/Debug/netcoreapp2.1/Razor/Views/Product/List.g.cshtml.cs(28,88):
    error CS0246: The type or namespace name 'ProductsListViewModel' could
    not be found (are you missing a using directive or an assembly
    reference?) [/Users/pedram/OneDrive - House of Friends
    AB/visualstudioonmacprojects/SportsStore/SportsStore.csproj]</p>
    
    <p>obj/Debug/netcoreapp2.1/Razor/Views/Product/List.g.cshtml.cs(128,71):
    error CS0246: The type or namespace name 'ProductsListViewModel' could
    not be found (are you missing a using directive or an assembly
    reference?) [/Users/pedram/OneDrive - House of Friends
    AB/visualstudioonmacprojects/SportsStore/SportsStore.csproj]</p>
    
    <p>The build failed. Please fix the build errors and run again.</p>
  </blockquote>
  
  <p>When I navigate to the files mentioned I realize that the class <code>ProductsListViewModel</code> needs to be addressed using its full name <code>SportsStore.Models.ViewModels.ProductsListViewModel</code> in both places for the project to build correctly. But this only resolves the problem until the next build. </p>
  
  <p>Cleaning the project before building (<code>dotnet clean</code>) does not seem to help either. </p>
  
  <p>I do not have much control over things happening inside the <strong>obj</strong> folder. What is causing this missing namespace problem?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>The contents of <code>/Views/Product/List.cshtml</code></p>
  
  <pre><code>@model ProductsListViewModel
  @foreach (var p in Model.Products) {
      @Html.Partial("ProductSummary", p)
  }
  &lt;div page-model="@Model.PagingInfo" page-action="List" page-classes-enabled="true"
       page-class="btn" page-class-normal="btn-secondary"
       page-class-selected="btn-primary" class="btn-group pull-right m-1"&gt;
  &lt;/div&gt;
  </code></pre>