简体   繁体   English

在C:分区而不是Program Files文件夹中安装WIX安装程序

[英]install WIX installer application in C: partition instead of Program Files folder

I have created a installer using WIX in VS2010.Currently when i install the application,it is installing the application and application related dependency files under C:\\Program Files\\Wixdemoapplication . 我已经在VS2010中使用WIX创建了一个安装程序。当前,当我安装该应用程序时,它将在C:\\Program Files\\Wixdemoapplication下安装该应用程序和与应用程序相关的依赖文件。 I need to customize this.I need to install the application directly under Wixdemoapplication under C:\\Wixdemoapplication and not C:\\Program Files\\Wixdemoapplication . 我需要对此进行自定义。我需要将应用程序直接安装在C:\\Wixdemoapplication下的Wixdemoapplication下,而不是C:\\Program Files\\Wixdemoapplication

Need help. 需要帮忙。

Try this (untested; but probably enough for what you need to do): 尝试以下操作(未经测试;但可能足以满足您的需要):

<Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="INSTALLFOLDER" Name="Wixdemoapplication" />
</Directory>

Otherwise, can do some other fun stuff, like: 否则,可以做一些其他有趣的事情,例如:

Add this custom action to Product.wxs: 将此自定义操作添加到Product.wxs:

<CustomAction Id="SpawnBrowseFolderDialog" BinaryKey="CustomActions" DllEntry="SpawnBrowseFolderDialog" Return="check" />

Add this into button in some dialog in Product.wxs: 将此添加到Product.wxs中某些对话框的按钮中:

<Control Id="BrowseButton" Type="PushButton" X="276" Y="126" Width="90" Height="18" Text="{\VSI_MS_Sans_Serif13.0_0_0}B&amp;rowse..." TabSkip="no">
    <Publish Event="DoAction" Value="SpawnBrowseFolderDialog"><![CDATA[1]]></Publish>
    <Publish Property="INSTALLFOLDER" Value="[INSTALLFOLDER]"><![CDATA[1]]></Publish>
</Control>

Add this custom action in (right click solution, add, new project, C# Custom Action project): 在以下位置添加此自定义操作(右键单击解决方案,添加新项目,C#自定义操作项目):

[CustomAction]
public static ActionResult SpawnBrowseFolderDialog(Session session)
{
    session.Log("Started the SpawnBrowseFolderDialog custom action.");
    try
    {
        Thread worker = new Thread(() =>
        {
            FolderBrowserDialog dialog = new FolderBrowserDialog();
            dialog.Description = "Please select an installation directory to house core files and components.";
            dialog.SelectedPath = session["INSTALLFOLDER"];
            DialogResult result = dialog.ShowDialog();
            session["INSTALLFOLDER"] = dialog.SelectedPath;
        });
        worker.SetApartmentState(ApartmentState.STA);
        worker.Start();
        worker.Join();
    }
    catch (Exception exception)
    {
        session.Log("Exception while trying to spawn the browse folder dialog. {0}", exception.ToString());
    }
    session.Log("Finished the SpawnBrowseFolderDialog custom action.");
    return ActionResult.Success;
}

将您的程序的<Directory>元素嵌套在<Directory Id="WindowsVolume">

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

相关问题 如何使用除Program Files文件夹之外的wix安装程序在自定义文件夹中安装应用程序 - How to install application in custom folder using wix installer,other than Program Files folder 为我的应用程序运行 Wix 安装程序后,无法创建/写入文件/文件夹,即使删除文件夹后也是如此 - Cannot create/write to files/folders after running a Wix Installer for my application, even after deleting folder wix-安装前删除旧程序文件夹 - wix - remove old program folder before install 文件夹作为WIX安装程序的源 - Folder as a source for WIX Installer 在安装wix安装程序的过程中如何复制folder / files1..to..files5 - How to copy folder/files1..to..files5 during the installation of wix installer 如何避免安装相同的应用程序实例 wix 安装程序 MSI 和 EXE? - How to avoid install same instance of application wix installer MSI & EXE? WiX安装程序.msi不会安装附加的.lib和.dll文件 - WiX installer .msi doesn't install the attached .lib and .dll files WIX安装程序以更新我的程序 - WIX installer for update my program 通过Wix将C#exe安装到Program Files文件夹后无法正常工作 - C# exe not working once installed to program files folder via Wix WiX为我的C#应用​​程序创建一个简单的安装程序和合并模块 - WiX to create a simple installer and merge module for my C# application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM