title: Why am I getting error CS0116 when building using a .rsp file?
body: <p>I'm trying to build a project using an csc.exe and a .rsp file, but I keep getting an error CS0116: A namespace cannot directly contain members such as fields or methods.  To troubleshoot, I made the simplest program ever...</p>
  
  <pre><code>class Program
  {
      public static void Main()
      {
  
      }
  }
  </code></pre>
  
  <p>From the command line, I run the command </p>
  
  <pre><code>"C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\csc.exe" Test.rsp
  </code></pre>
  
  <p>Test.rsp looks like this</p>
  
  <pre><code>/nologo
  /target:exe
  /platform:x86
  /out:"Test.exe"
  "Test.cs"
  </code></pre>
  
  <hr>
  
  <p>If I compile Test.cs directly, I don't get this error.  For example, if I run this command at the command line...</p>
  
  <pre><code>"C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\csc.exe" /target:exe /platform:x86 /out:"Test.exe" "Test.cs"
  </code></pre>
  
  <p>The "Program" is created successfully.</p>
  
  <p>So why is compiling using a .rsp file causing this error?</p>