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 383 views
1 answer 246 views
1 answer 441 views
1 answer 208 views
2 answers 358 views
1 answer 228 views
...