title: why I am getting " 'some class' does not contain a definition for 'some method' " error while the class has that method?
body: <p>I am trying to finish a simple tutorial for using c++ library with c# console application.
  Here I have a simple class library:</p>
  
  <p><strong>cpp file:</strong></p>
  
  <pre><code>#include "stdafx.h"
  
  #include "ClassLibraryCPP.h"
  
  using namespace ClassLibraryCPP;
  
  void myClass::test() 
  {
      Console::WriteLine("hello cpp/cli!");
  }
  </code></pre>
  
  <p><strong>header file:</strong></p>
  
  <pre><code>#pragma once
  
  using namespace System;
  
  namespace ClassLibraryCPP
  {
  
      public class myClass
      {
      public:
          void test();
      };
  }
  </code></pre>
  
  <p><strong>and now here is my c# console:</strong></p>
  
  <pre><code>using ClassLibraryCPP;
  
  namespace ConsoleApplicationCS
  {
      class Program
      {
          static void Main(string[] args)
          {
              myClass testClass;
              testClass = new myClass();
              testClass.test();
          }
      }
  }
  </code></pre>
  
  <p>and I get this:</p>
  
  <blockquote>
    <p>'myClass' does not contain a definition for 'test' and no extension
    method 'test' accepting a first argument of type 'myClass' could be
    found (are you missing a using directive or an assembly reference?)</p>
  </blockquote>
  
  <p>But I have made <code>myClass</code> and <code>test</code> method <code>public</code> so why <code>.test()</code> is not visible to console application?</p>
  
  <hr>
  
  <p>Update:
  adding ref to make managed class and then rebuilding the C++ project (by right clicking and rebuild not just rebuilding the solution) solved the problem.
  I also found this question related:
  <a href="https://stackoverflow.com/questions/10168128/c-sharp-code-cant-see-the-methods-in-my-c-dll">C# code can&#39;t &quot;see&quot; the methods in my C++ dll</a>
  I still don't get how this works:
  <a href="https://www.youtube.com/watch?v=xTRTY-fOIe8&amp;t=1800s" rel="nofollow noreferrer">https://www.youtube.com/watch?v=xTRTY-fOIe8&amp;t=1800s</a></p>