title: Reference C++/CLI class library (compiled dll) in C# project
body: <p>I have a very simple C++ class library that has two account types in it called <strong>Checking</strong> and <strong>Savings</strong>.  I have built this project and compiled it into a .dll called Accounts. I have referenced the <strong>Accounts.dll</strong> in my C# Console application.  To no avail, I am trying to use the static classes <strong>deposit</strong> and <strong>withdraw</strong> from the <strong>Savings</strong> and <strong>Checking</strong> classes respectively.  I do not see the functions show up in the Object Browser or Intellisense and I am not able to get it to build when I try to access those functions, otherwise I am able to build and run when I comment out the call to mySavings.deposit(arg1,arg2)...</p>
  
  <p>Any idea what I am doing incorrectly here?  I often reference .dlls from other projects and third parties but this is the first time referencing a C++ .dll within a C# project.</p>
  
  <p>C++ Class Library</p>
  
  <pre><code>#pragma once
  using namespace System;
  
  namespace Accounts {
  
    public ref class Savings
    {
      public:
          unsigned accountNumber;
          double balance;
          static double deposit(Savings s, double amount)
          {
              s.balance += amount;
              return s.balance;
          }
    };
  
    public ref class Checking
    {
      public:
          unsigned accountNumber;
          double balance;
          static double withdraw(Checking c, double amount)
          {
              c.balance -= amount;
              return c.balance;
          }
    };
  }
  </code></pre>
  
  <p>C# Console Application that references the above compiled dynamic link library</p>
  
  <pre><code>using Accounts;
  
  class Program
  {
    static void Main(string[] args)
    {
      Savings mySavings = new Savings();  // works but object is empty
      mySavings.deposit(mySavings, 100);  // still breaks
    }
  }
  </code></pre>
  
  <p>I am getting the following error: 'Accounts.Savings' does not contain a definition for 'deposit' and no extension method 'deposit' accepting a first argument of type 'Accounts.Savings' could be found (are you missing a using directive or an assembly reference?)</p>
  
  <p>Any help would be greatly appreciated.</p>