如何获取用户计算机上应用程序安装的可执行路径 [英] how to get Excutable path of application install on user machine

查看:101
本文介绍了如何获取用户计算机上应用程序安装的可执行路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在创建Web应用程序的安装程序,我想获取用户安装应用程序的应用程序的目录(可安装路径)

I create the setup of web application now i want to get the directory (installable path) of application where user install the application

推荐答案

任何应用程序正在运行时,其可执行路径的计算方式如下:

When any application is running, its executable path is calculated in the following way:

string exePath =
   System.IO.Path.GetDirectoryName(
       System.Assembly.GetEntryAssembly().Location);



警告!还有更多的方法可以做到;有些人会建议他们.您需要使用此方法,因为它不取决于应用程序的托管方式和其他因素.

—SA



Warning! There are few more ways to do it; and some will advise them. You need to use this method as it does not depend on how the application is hosted and other factors.

—SA


在这里您可以找到更多......

C#路径示例 [ ^ ]
Here you go for more...

C# Path Examples[^]


我认为Server.MapPath();将为您提供应用程序的安装路径.

参考: http://msdn.microsoft.com/en-us/library/ms178116.aspx [ ^ ]
I think Server.MapPath(); will provide you the installed path of application.

Refer: http://msdn.microsoft.com/en-us/library/ms178116.aspx[^]


这篇关于如何获取用户计算机上应用程序安装的可执行路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆