如何获得ClickOnce应用程序文件夹路径如何获得、应用程序、文件夹、路径

2023-09-02 11:49:33 作者:欲握玫瑰必承其痛

我需要在控制台的ClickOnce 。应用(可执行文件)所在的同一文件夹写入文件。它从启动文件夹。

I need to write a file in the same folder where a console ClickOnce .application (executable file) resides. The folder where it launches from.

我试图用 Application.StartupPath &放大器; Path.GetDirectoryName(Assembly.GetExecutingAssembly()位置) 但路径指向一个子文件夹下的 C:文件和放大器;设置。我该如何获取路径,其中。应用位于?

I tried using Application.StartupPath & Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) but the path is pointing to a subfolder under c:Documents & Settings. How do I get the path where the .application resides in?

推荐答案

要找到该文件夹​​的位置,你可以运行应用程序,打开任务管理器(CTRL-SHIFT-ESC),选择应用程序,然后右键单击|打开文件位置。

To find the folder location, you can just run the app, open the task manager (CTRL-SHIFT-ESC), select the app and right-click|Open file location.