What is the WiX equivilent of Environment.SpecialFolder.ApplicationData from .NET?

前端 未结 1 1989
借酒劲吻你
借酒劲吻你 2020-12-24 06:51

I need to install a file into the Environment.SpecialFolder.ApplicationData folder, which differs between XP and Vista. Is there a built in way to reference the

相关标签:
1条回答
  • 2020-12-24 07:26

    Use Directory element with Id set to AppDataFolder:

    <Directory Id="AppDataFolder">
      <Directory Id="MyAppFolder" Name="My">
        <Component Id="MyComponent">
          <File Source="Files\test1.txt" />
        </Component>
      </Directory>
    </Directory>
    

    This will result in test1.txt being installed to C:\Users\username\AppData\Roaming\My on Windows 7 and to C:\Documents and Settings\username\Application Data\My on Windows XP.

    MSDN has a list of properties that you can use to reference special folders.

    0 讨论(0)
提交回复
热议问题