我对我的目录有问题,我希望我的InstallDir是我最好的父目录,任何其他的Dir都包含在这个文件夹结构中。我尝试过多种方法,似乎无法解决这个问题,但我的目标是能够使用installDirDialog更改安装位置。保持不变的目录将正确安装,但如果要更改安装位置,则只生成新的文件夹结构,并将文件安装到默认位置。我知道为什么它要安装到这个位置,因为它引用了一个静态字符串,所以我只使用下面的例子来简化我遇到的问题。
string dirs = @"%ProgramFiles%\My Company\My Product";
var project = new ManagedProject("MyProduct",
new InstallDir(dirs),
new Dir(dirs + @"\DataAPI",
new Files(@"E:\Temp\installertemp\DataAPI\*.*"))); 另一种方法是使用MSI属性并将其设置为安装路径。
public class General
{
public static string Product = "PRODUCT";
public static string InstallLocation = "INSTALLDIRECTORY";
}在setup.cs string dirs = General.InstallLocation;中
然后在安装对话框中设置此属性。MsiRuntime.Session[General.InstallLocation] = installDir.Text;
这也不起作用,只将INSTALLDIRECTORY作为路径传递。
发布于 2018-10-25 13:40:16
在浪费了无数个小时之后,解决方案实际上非常简单,维克斯夏普的友好人士向我表明了这一点。
只需移动instalDir的末尾括号,就可以包含任何子目录和它们的文件。
new InstallDir(dirs,
new Dir("DataAPI",
new Files(@"E:\Temp\installertemp\DataAPI\*.*"))); https://stackoverflow.com/questions/52988804
复制相似问题