How to get project path in C#

2 Answers

0 votes
using System.IO;

namespace WinFormsApp1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            label1.Text = Directory.GetCurrentDirectory();

        }
    }
}




/*
 * run:
 *
 * "C:\\Users\\A\\source\\WinFormsApp1\\WinFormsApp1\\bin\\Debug\\net7.0-windows"
 * 
 */


 



answered Aug 11, 2023 by avibootz
0 votes
namespace WinFormsApp1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            label1.Text = Environment.CurrentDirectory;

        }
    }
}




/*
 * run:
 *
 * "C:\\Users\\A\\source\\WinFormsApp1\\WinFormsApp1\\bin\\Debug\\net7.0-windows"
 * 
 */


 



answered Aug 11, 2023 by avibootz

Related questions

2 answers 252 views
1 answer 143 views
1 answer 337 views
1 answer 109 views
2 answers 213 views
1 answer 121 views
...