安装包中我的软件包文件夹的位置 [英] Location of my Package Folder through Setup

查看:77
本文介绍了安装包中我的软件包文件夹的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过setup.MSI安装软件包并指定软件包安装位置,即(``C:\ Program Files \ Tech Soft \ MNCP Setup \'').
我的观点是,如何通过调试模式分配软件包设置的位置,即(我想获取软件包位置"C:\ Program Files \ Tech Soft \ MNCP设置")? > 请帮助我.....

I install the package through setup.MSI & assign the location of my Package setup i.e.(''C:\Program Files\Tech Soft\MNCP Setup\'').
My point of view that, How will I get assigning location of my Package setup through debugging mode i.e.(I want to get Package location ''C:\Program Files\Tech Soft\MNCP Setup'')????
Please help me.....

推荐答案

我认为您永远不需要它.您的应用程序的第一个功能应该是可以在and目录中运行.在开始安装之前,您应该在开发/测试期间测试在所有情况下这种情况是否成立.在进行开发时,您应该至少有两个不同的输出目录(通常,对于Release,为另一个目录,对于Debug配置,为另一个目录),并且您的代码在其中的任何一个以及在此目录或另一个目录中的任何其他目录中都应能正常工作计算机.使用安装程序部署它时,它也应该起作用.

现在,您是否需要确定运行时程序集和应用程序的位置?这是最可靠的方法:

如果您有某些程序集,请使用System.Reflection.Assembly.Location.如果您的代码在应用程序中运行,则应该能够确定应用程序入口组件的主模块的位置(在其中调用了Main之类的入口点).以下代码以这种方式工作:

I don''t think you ever need it. The first feature of your application should be able to run in and directory. You should test that this holds in all cases during development/testing, before you get to installation. When you do development, you should have at least two different output directories (usually, on for Release, another for Debug configuration), and your code should work equally well in any of them, as well as in any other directory on this or another computer. When you deploy it using setup, it should also work.

Now, do you need to determine the location of your assembly and application during run-time? Here is the most reliable method:

If you have some assembly, use System.Reflection.Assembly.Location. If your code is running in an application, you should be able to determine the location of the main module of the application''s entry assembly (where the entry point like Main was called). The following code works this way:

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



还有其他方法,但是其中一些方法会根据应用程序的托管方式提供不同的结果:调试主机或由Service Controller托管可以提供不同的结果.因此,请使用我显示的方法.

—SA



There are other methods, but some of them gives different results depending on how the application is hosted: debug host or hosting by Service Controller can give different results. So, please use the method I''ve shown.

—SA


这篇关于安装包中我的软件包文件夹的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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