title: Get current dir in a class library
body: <p>I'm developing a C# library with .Net Framework 4.5.1 to use it in a Windows 8.1 desktop application.</p>
  
  <p>Inside this library project I have a <code>JSON</code> file, and I want to load it. First, I have tried to get current directory with this:</p>
  
  <pre><code>string currentDir = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
  </code></pre>
  
  <p>But, I have test it and <code>Assembly.GetEntryAssembly()</code> is null.</p>
  
  <p>Maybe, I can use a resource file instead of a JSON file.</p>
  
  <p>This is the method:</p>
  
  <pre><code>private void LoadData()
  {
      string currentDir = 
          Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
  
      string file = 
          Path.Combine(currentDir, cardsDir, cardsFile);
  
      string json =
          File.ReadAllText(file);
  
      Deck = JsonConvert.DeserializeObject&lt;Card[]&gt;(json);
  }
  </code></pre>
  
  <p>Any idea? Is there a better approach? How can I get current dir?</p>