Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8655103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:56:51+00:00 2026-06-12T14:56:51+00:00

Ok, I am moving a few of my Winform projects from Framework 4.0 to

  • 0

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:

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;
            }
        }
    }
}

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: LINK1 and LINK2 both show examples using the System.Windows.Forms namespace. So my question is does anyone have a workaround for this issue?

**Update**

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T14:56:53+00:00Added an answer on June 12, 2026 at 2:56 pm

    You can use Directory.GetCurrentDirectory() or AppDomain.CurrentDomain.BaseDirectory instead:

    Path.Combine(Directory.GetCurrentDirectory(), 
                     errLogFile + "_ErrorLog.txt");
    

    Or:

    Path.Combine(AppDomain.CurrentDomain.BaseDirectory, 
                     errLogFile + "_ErrorLog.txt");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Moving rails app to production and running into the routing issues. I've read this
I am moving a few functions from a Managed C++ Winforms app to a
Background: I'm moving my application from npgsql v1 to npgsql v2.0.9. After a few
I'm a few weeks into moving all of our source code into an SVN
PREFACE: Yes we're moving away from VSS in the next few months. One of
A client is moving from their old hosting to mine. They have a few
I'm moving some code over to GCC 4.7 (from 4.6) and ran into a
I'm building a few Java-only projects using simple-build-tool. When I publish the artifacts from
So I have been working on a few projects using audio and images from
I'm moving from a shared web hosting company to a VPS. And I'm trying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.