title: CSS isolation for a Razor component which is fully defined with a C# class
body: <p>I have a Razor component, called <code>RankingCell</code>, which is fully defined with a C# class. <strong>There is not any <code>.razor</code> file associated to it</strong>:</p>
  <pre><code>// RankingCell.razor.cs
  using Microsoft.AspNetCore.Components;
  using Microsoft.AspNetCore.Components.Rendering;
  
  namespace MyProj {
      public class RankingCell: ComponentBase {
          // Some parameters and properties
  
          [Parameter]
          public string CellElt { get; set; }
  
          protected override void BuildRenderTree(RenderTreeBuilder builder) {
              /*
               * The thing which prevents me from using a &quot;RankingCell.razor&quot; file to define it.
               * In a .razor file it would be something like this but it is not possible:
               * 
               * &lt;@CellElt ... &gt;@* ... *@&lt;/@CellElt&gt;
               * 
               * Please have a look there for for details about how I solved this issue for the component: 
               * https://stackoverflow.com/questions/64196493/in-blazor-how-can-i-dynamically-change-an-html-tag
               */
              builder.OpenElement(0, CellElt);
  
              // ...
  
              builder.CloseElement();
          }
      }
  }
  </code></pre>
  <p>I would like to associate a stylesheet to my <code>RankingCell</code> component, so I create such a file following <a href="https://docs.microsoft.com/en-us/aspnet/core/blazor/components/css-isolation" rel="nofollow noreferrer">Microsoft's documentation about CSS isolation</a>, i.e. a CSS file called <code>RankingCell.razor.css</code>:</p>
  <pre class="lang-css prettyprint-override"><code>/* RankingCell.razor.css */
  .ranking-cell {
      /* RankingCell style */
  }
  </code></pre>
  <p>But when I build my project (using <code>dotnet build</code>), I have got the following error:</p>
  <pre><code>RankingCell.razor.css : error BLAZOR102: The scoped css file 'RankingCell.razor.css' was defined but no associated razor component was found for it.
  </code></pre>
  <p><strong>How to fix this BLAZOR102 issue? How to manage to associate a stylesheet with my component?</strong></p>
  <p>The component does not look buggy. I have not got any compiling error when no CSS scoped file is associated to it and it works in my Blazor project.</p>
  <p>I also tried to create an empty <code>RankingCell.razor</code> file but I had got another which told me that <code>BuildRenderTree</code> was defined elsewhere (of course since it is already fully written in <code>RankingCell.razor.cs</code>, where the component is fully defined).</p>