Wix 3.11.2和Visual Studio Community 2019在这里。我的项目具有以下目录结构:
...\Source\Repos\my-app-setup\
my-app-setup\
bin\
obj\
testo\
fizz\
abc\
def\
ghi\
abba.txt
buzz\
bar.txt
foo.txt
my-app.exe
my-app-setup.wixproj
my-app-setup.wxs
my-app-setup.sln
我的my-app-setup.wxs
文件如下:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="MyApp" Language="1033" Version="1.0.0.0" Manufacturer="MyCompany" UpgradeCode="1e540666-dda2-4cbe-91b7-ac9525d96c86">
<Package Description="MyApp tool" Compressed="yes" />
<MediaTemplate EmbedCab="yes"/>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="MyApp" />
</Directory>
<Directory Id="DesktopFolder" Name="Desktop">
<Component Id="ApplicationShortcutDesktop" Guid="*">
<Shortcut Id="ApplicationDesktopShortcut"
Name="MyApp"
Description="Shortcut for MyApp"
Target="[INSTALLFOLDER]my-app.exe"
WorkingDirectory="INSTALLFOLDER"/>
<RemoveFolder Id="DesktopFolder" On="uninstall"/>
<RegistryValue
Root="HKCU"
Key="Software/MyApp"
Name="installed"
Type="integer"
Value="1"
KeyPath="yes"/>
</Component>
</Directory>
</Directory>
<Component Id="FooTxtComponent" Directory="INSTALLFOLDER">
<File Source="testo/foo.txt" />
</Component>
<Component Id="AbbaComponent" Directory="INSTALLFOLDER">
<File Source="testo/fizz/abc/def/ghi/abba.txt" />
</Component>
<Component Id="ExecutableComponent" Directory="INSTALLFOLDER">
<File Source="my-app.exe" />
</Component>
<Feature Id="MainFeature" Title="MyApp" Level="1">
<ComponentRef Id="FooTxtComponent" />
<ComponentRef Id="AbbaComponent" />
<ComponentRef Id="ExecutableComponent" />
<ComponentRef Id="ApplicationShortcutDesktop" />
</Feature>
</Product>
</Wix>
因此,它基本上只是将项目中的一堆文件复制到C:\Program Files (x86)\MyApp
目录中,然后在桌面上创建一个快捷方式(到EXE)。简单的东西。
当我构建它并运行MSI时,生成的C:\Program Files (x86)\MyApp
目录如下所示:
C:\Program Files (x86)\
MyApp\
foo.txt
abba.txt
my-app.exe
因此,WiX只是将我指定的文件拖放到与EXE文件相同级别的MyApp
目录中。我不想要这个;我想保留与VS项目中相同的递归目录结构。因此,除了上述之外,我希望WiX MSI生成:
C:\Program Files (x86)\
MyApp\
testo\
fizz\
abc\
def\
ghi\
abba.txt
foo.txt
my-app.exe
最简单的方法是什么?
谢谢!
插图:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLDIR" Name="Example">
<Component>
<File Source="example.exe"/>
</Component>
</Directory>
</Directory>
</Directory>
也许还会检查: