如何使用VS2015_ROOT_FOLDER在Wix 3.10中设置安装位置

时间:2015-09-10 21:52:14

标签: wix

使用Wix 3.10,我正在尝试在公共扩展文件夹中安装扩展程序。但是我无法弄清楚如何使用VS2015_ROOT_FOLDER属性。

我在Product元素中有以下内容:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product Id="*" Name="Test" Language="1033" Version="1.0.0.0" Manufacturer="MSFT" UpgradeCode="2c2ba7d9-387a-4da9-b7f2-82d737b839b6" Codepage="1252">
    <Package InstallerVersion="500" Compressed="yes" InstallScope="perMachine" />
    <PropertyRef Id="VS2015_ROOT_FOLDER" />

    <MediaTemplate EmbedCab="yes"/>

    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="VS2015_ROOT_FOLDER">
        <Directory Id="TSTDIR" Name="test" />
      </Directory>
    </Directory>

    <Feature Id="FeatureId" Title="test components">
      <ComponentGroupRef Id="TestComponents" />
    </Feature>
  </Product>

  <Fragment>
    <ComponentGroup Id="TestComponents" Directory="TSTDIR">
      <Component Id="VS_Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll">
        <File Id="Microsoft.VisualStudio.TypeScript.Internal" Source="Microsoft.VisualStudio.TypeScript.Internal.dll" />
      </Component>
    </ComponentGroup>
  </Fragment>
</Wix>

但是这会导致以下错误:

"Test.wixproj" (default target) (1) -> (Link target) ->
test.wxs(22): error LGHT0231: The component 'VS_Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll' has a key file with path 'TARGETDIR\test\microsoft.visualstudio.typescript.internal.dll'. Since this path is not rooted in one of the standard directories (like ProgramFilesFolder), this component does not fit the criteria for having an automatically generated guid.
(This error may also occur if a path contains a likely standard directory such as nesting a directory with name "Common Files" under ProgramFilesFolder.) [Test.wixproj]

我的问题是如何解决此错误,因为VS2015_ROOT_FOLDER根植于Program Files

1 个答案:

答案 0 :(得分:0)

好吧,您只需要在sscanf(string,"%*[^|]%*c%[^|]%*c", vars) ProgramFilesFolder这个更改之间添加TARGETDIR即可使其发挥作用。

VS2015_ROOT_FOLDER