title: .Net Scripting Engine (C#) - Is there some sort of "header file" or "dll references file" for .Net languages?
body: <p>I'm making a small scripting engine in C# and I was wondering, is there some sort of #compiler directives or some sort of other header-like file I can compile with my script files to define what Managed Dlls my script files are referencing?</p>
  
  <pre><code>public static CompilerResults LoadScript(
      string SourceCodeFile, string[] References)
  {
      var Parameters = new CompilerParameters()
      {
          GenerateExecutable = false,
          GenerateInMemory = true,
          IncludeDebugInformation = false,
      };
  
      Parameters.ReferencedAssemblies.AddRange(References);
  
      return CSharpCodeProvider.CreateProvider(
          CSharpCodeProvider.GetLanguageFromExtension(
              Path.GetExtension(SourceCodeFile)))
                  .CompileAssemblyFromFile(Parameters, SourceCodeFile);
  }</code></pre>
  
  <p>I would love to be able to eliminate this line of code:<pre><code>Parameters.ReferencedAssemblies.AddRange(References);</code></pre>and put that information in my scripts instead. The problem is I do not necessarily know ahead of time what .dlls the scripts are going to reference. My current solution right now is to parse a custom "script.cs.refs" file that looks something like this:<pre><code>"System.dll","System.Data.dll","SomeOther.dll","Ect.dll"</code></pre>
  Any help on finding out where visual studio stores your references to dlls and if it has to be defined in a separate file, if there is a standardized format I should be using that I can load into the compiler that tells it this information, would be greatly appreciated!</p>