Install directory from deployment projects

删除回忆录丶 提交于 2019-12-01 20:14:30

Take a look at the Installer class. Add a new class derived from this class to your application's project. Don't forget to apply the RunInstaller attribute.

In your deployment project, add a Custom Action for Install and Commit. For the CustomActionData property for the Install custom action, enter /Targetdir="[TARGETDIR]\".

In your Installer class that you created in the application's project, override the Install method, and in this method you can get the installation directory like this:

string targetDir = Context.Parameters[ "TargetDir" ];

If you have a really simple setup, where the current assembly is installed in the main TARGETDIR, then you can use:

String targetDir = new System.IO.FileInfo(GetType().Assembly.Location).DirectoryName;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!