title: How to link Dafny code with a C# assembly
body: <p>I'm trying to build and run an <a href="https://stackoverflow.com/a/52470751/94977">example program by James Wilcox that combines Dafny code and C# code</a>. I'm using <code>mono</code> on a Mac. The build command in that answer doesn't work for me:</p>
  <pre><code>$ dafny fileiotest.dfy fileionative.cs
  Dafny 3.0.0.20820
  
  Dafny program verifier finished with 4 verified, 0 errors
  Compiled program written to fileiotest.cs
  Errors compiling program into fileiotest
  (8,24): error CS0234: The type or namespace name 'Net' does not exist in the namespace 'System' (are you missing an assembly reference?)
  
  (9,26): error CS0234: The type or namespace name 'Net' does not exist in the namespace 'System' (are you missing an assembly reference?)
  
  (28,28): error CS0012: The type 'TextWriter' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime.Extensions, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
  
  (43,28): error CS0012: The type 'TextWriter' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime.Extensions, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
  
  (58,28): error CS0012: The type 'TextWriter' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime.Extensions, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
  
  (73,28): error CS0012: The type 'TextWriter' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime.Extensions, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
  
  (87,28): error CS0012: The type 'TextWriter' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime.Extensions, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
  
  (1858,18): error CS0117: 'FileStream' does not contain a definition for 'Open'
  
  (1870,23): error CS1061: 'FileStream' does not contain a definition for 'Write' and no accessible extension method 'Write' accepting a first argument of type 'FileStream' could be found (are you missing a using directive or an assembly reference?)
  </code></pre>
  <p>How can I &quot;add a reference to assembly&quot;? Can it be done on the <code>dafny</code> command line?</p>