title: What is the best way to find directory path from an EF migration script?
body: <p>I'm using Entity Framework code first migrations in my project. One of these migrations populates a database table by reading in data from <code>csv</code> files located in a directory in the project. The project structure looks like this:</p>
  
  <pre><code>- Soulution
      - Project
        - Migrations
          - CSVFolder
            - file1.csv
            - file2.csv
        - Migration1.cs
        - Migration2.cs
  </code></pre>
  
  <p>In my <code>Up()</code> method, I get these files like so:</p>
  
  <pre><code>public override void Up()
  {
      var migrationsDir = AppDomain.CurrentDomain.BaseDirectory + "/Migrations/CSVFolder/";   // For some reason, Path.Combine() doesn't work for me here so I manually concatenate the strings.
      var templateFiles = Directory.GetFiles(migrationsDir, "*.csv");
  
      foreach (var filename in templateFiles)
      {
          Sql();  // SQL Insert statement here.
      }
  }
  </code></pre>
  
  <p>This runs fine on my dev machine but when I deploy this to the test server with Octopus, I get a path not found exception</p>
  
  <blockquote>
    <p>Could not find a part of the path
    'C:\Octopus\Applications\Test\Solution\1.1-alpha21\Migrations\CSVFolder'.</p>
  </blockquote>
  
  <p>I've checked the 'drop' folder and the output there includes <code>Migrations &gt; CSVFolder</code>. </p>
  
  <p>I've tried a few different ways to get the path to the folder but they work either locally or on the server. What's the best way to get the path that will work both locally and on the server?</p>