title: getting file path in asp.net class library project on Azure WebApp
body: <p>I am having a class library in which I am access a file from the application path using the below code. It wont work on azure as it cannot find the application path. How to make it work azure as it works fine on my local machine.</p>
  
  <pre><code> private string GetProjectPath()
          {
              string SolutionName = "MyApi.sln";
              //Get name of the target project which we want to test
  
              var projectName = typeof(TerminationMatchInquiry).GetTypeInfo().Assembly.GetName().Name;
  
              //Get currently executing test project path
              var applicationBasePath = new Uri((typeof(TerminationMatchInquiry).GetTypeInfo().Assembly.CodeBase)).LocalPath;
              //Find the folder which contains the solution file. We then use this information to find the 
              //target project which we want to test
              DirectoryInfo directoryInfo = new DirectoryInfo(applicationBasePath);
              do
              {
                  var solutionFileInfo = new FileInfo(Path.Combine(directoryInfo.FullName, SolutionName));
                  if (solutionFileInfo.Exists)
                  {
                      return Path.GetFullPath(Path.Combine(directoryInfo.FullName, projectName));
                  }
                  directoryInfo = directoryInfo.Parent;
              }
              while (directoryInfo.Parent != null);
  
              throw new Exception($"Solution root could not be located using application root {applicationBasePath}");
          }
  </code></pre>