title: Get Application Path
body: <p>Ok, I am moving a few of my Winform projects from Framework 4.0 to Framework 4.5 and I am running into a problem trying to find the Executable path from a Class Library. I have an error logging class that I use to log errors here is a snippet of my code:</p>
  
  <pre><code>using System;
  using System.IO;
  using System.Windows.Forms;
  
  namespace FunctionClassLibrary
  {
      public static class ErrorLogging
      {
          public static string errLogFullPath
          {
              get
              {
                  string errLogFile = "Application";
                  m_errLogFullPath = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), errLogFile + "_ErrorLog.txt");
                  return m_errLogFullPath;
              }
          }
      }
  }
  </code></pre>
  
  <p>as you can see I am able to reference the System.Windows.Forms namespace which in turn exposes the Application.ExecutablePath property. Apparently in Framework 4.5 you can no longer reference System.Windows.Forms namespace. I have been googling all morning with no success, these two MSDN links: <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.application.startuppath.aspx" rel="nofollow">LINK1</a> and <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.application.userappdatapath.aspx" rel="nofollow">LINK2</a> both show examples using the System.Windows.Forms namespace. So my question is does anyone have a workaround for this issue?</p>
  
  <h1>**Update**</h1>
  
  <p>Ok, I am losing my mind, I just realized that I can simply use the Environment.GetFolderPath method to find the CommonProgramFiles folder, which is where I should be storing this file anyway. Sorry to bother everyone this morning.</p>