title: How to create "Code Behind" Blazor Components with VS 2019?
body: <p>I can create an inline component like</p>
  
  <pre class="lang-cs prettyprint-override"><code>&lt;h1&gt;@foo&lt;/h1&gt;
  
  @functions {
  
      string foo = "foo";
  }
  </code></pre>
  
  <p>However when I create <code>Foo.razor</code> containing just:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;h1&gt;@foo&lt;/h1&gt;
  </code></pre>
  
  <p>And <code>Foo.razor.cs</code> containing:</p>
  
  <pre class="lang-cs prettyprint-override"><code>namespace MyApp.Client.Components {
      public class Foo: ComponentBase {
  
          public string foo;
      }
  }
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>Error   CS0101  The namespace 'MyApp.Client.Components' already contains a definition for 'Foo'
  </code></pre>
  
  <p>I am using the latest VS 2019 and Blazor libraries.</p>
  
  <p>What am I doing wrong?</p>