简体   繁体   English

如何为具有多个目标文件路径的EXE文件创建安装程序

[英]How to Create Installer For EXE Files With Multiple Destination Path for files

I have one small requirement.I have to create one installer which would deploy (paste embedded txt and config files) file to different locations 我有一个小要求,我必须创建一个安装程序,以将文件(粘贴嵌入式txt和配置文件)部署到不同的位置

Situation 情况

  1. At the start of installation ,it should ask for Main installation path.Or there should be provision to pick that path from some Autorun or Ini file 在安装开始时,它应该询问Main安装路径。或者应该提供从一些Autorun或Ini文件中选择该路径的规定。
  2. Selected path will have different destination folder.Installation utility should deploy file to their destination folders.Eg file1 should go to \\File_Conf folder...File2 should go to \\business_Rules folder 所选路径将具有不同的目标文件夹。安装实用程序应将文件部署到其目标文件夹中。例如,文件1应该进入\\ File_Conf文件夹...文件2应该进入\\ business_Rules文件夹

I have found one interesting tool WIX .I am still digging into details of it. 我发现了一个有趣的工具WIX 。我仍在深入研究它的细节。 Does anyone has worked on same requirement any hint would be okay. 是否有人按照相同的要求进行工作,任何提示都可以。 As per my understanding we cannot embed custom script in VS Setup project. 根据我的理解,我们无法在VS Setup项目中嵌入自定义脚本。 InstallSheild isgood for it but it is licensed. InstallSheild对此很有用,但已获得许可。

I think you can keep all the files & configuration file in one temporary directory in application directory and you can add custom action installer by which you can move the files to required directory from temp directory based on the config/ini file. 我认为您可以将所有文件和配置文件保留在应用程序目录的一个临时目录中,并且可以添加自定义操作安装程序,通过该安装程序,您可以基于config / ini文件将文件从temp目录移至所需目录。 At the end of installation you can delete the temp directory. 在安装结束时,您可以删除temp目录。 From my hope this could be the solution.There could be some other optimized way of doing this.I did'nt get time to explain with code. 我希望这可能是解决方案,可能会有其他优化的方法来实现,我没有时间解释代码。

You can do this by defining different Directories and then referring to them in your "Component list". 为此,您可以定义不同的目录,然后在“组件列表”中引用它们。 You'll probably need to provide a GUI in which the user can define his/her INSTALLFOLDER for the separate component (in this case DOCUMENTATION). 您可能需要提供一个GUI,用户可以在其中为单独的组件(在本例中为DOCUMENTATION)定义其INSTALLFOLDER。

If you need more info, let me know. 如果您需要更多信息,请告诉我。

<Directory Id="ProgramFilesFolder">
                <Directory Id="FirstSubFolder" Name="First Sub Folder">
                    <Directory Id="SecondSubFolder" Name="Second Sub Folder">
                        <Directory Id="DOCUMENTATIONFOLDER" Name="Documentation" ComponentGuidGenerationSeed="a9f690d3-22b3-488f-bdac-bb665c25933c"/>
                    </Directory>
                </Directory>
            </Directory>

In my case we created separate .wxs files (created by heat). 以我为例,我们创建了单独的.wxs文件(通过热量创建)。 The Component and File elements are less important than the structure (Directory < Component < File). Component和File元素的重要性不如结构(Directory <Component <File)。

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
        <DirectoryRef Id="DOCUMENTATIONFOLDER">
            <Component Id="File.pdf" Guid="*">
                <File Id="File.pdf" KeyPath="yes" Source="$(var.gatheredDocumentation)\File.pdf" />
            </Component>
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <ComponentGroup Id="DocumentationComponents">
            <ComponentRef Id="File.pdf" />
        </ComponentGroup>
    </Fragment>
</Wix>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM