维克斯 'undefined preprocessor variable'

Wix 'undefined preprocessor variable'

我见过这样的问题,但他们似乎对我没有帮助。

我正在玩一个测试网络应用程序。

我将它添加到我的 RStp.wixproj 中,我遇到了困难,但它有效,它生成了 Frags.wxs:

<Target Name="BeforeBuild">
    <Exec Command=" &quot;$(WiX)bin\heat.exe&quot; project &quot;..\WebR\WebR.csproj&quot; -cg Portals.Vendor -gg -pog Binaries -pog Content –configuration &quot;release&quot; -platform &quot;AnyCPU&quot; –out &quot;Frags.wxs&quot; " />
    <ItemGroup>
      <Compile Include="Frags.wxs" />
    </ItemGroup>
  </Target>

我的 Frags.wxs 看起来像这样:

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
        <DirectoryRef Id="WebR.Binaries" />
    </Fragment>
    <Fragment>
        <ComponentGroup Id="WebR.Binaries">
            <ComponentRef Id="cmp7AE3B693619BAD570BB795DC740F74CA" />
        </ComponentGroup>
    </Fragment>
    <Fragment>
        <DirectoryRef Id="WebR.Content">
            <Directory Id="dirBB5AA78A6132241A7A39F7899E66D36C" Name="Fold" />
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <ComponentGroup Id="WebR.Content">
            <ComponentRef Id="cmp434BA57B5F42786DB41F7D30B9C8A2AA" />
            <ComponentRef Id="cmp827A8854133966F2160835E612413FA7" />
            <ComponentRef Id="cmpF279DD78D3B3BE5386C8535E2A85FC5F" />
        </ComponentGroup>
    </Fragment>
    <Fragment>
        <ComponentGroup Id="Portals.Vendor">
            <Component Id="cmp7AE3B693619BAD570BB795DC740F74CA" Directory="WebR.Binaries" Guid="{9F6BEFC1-6226-4C1D-A1B0-1C7D6355DB60}">
                <File Id="filB23D27862A7D96131D5E2F7C7CCCAA8B" Source="$(var.WebR.TargetDir)\WebR.dll" />
            </Component>
            <Component Id="cmp434BA57B5F42786DB41F7D30B9C8A2AA" Directory="WebR.Content" Guid="{F0733DE8-9B04-4F65-ABA3-954B71E6CC00}">
                <File Id="fil85B5BB89317EA74AFB68409ADF6BA4C7" Source="$(var.WebR.ProjectDir)\Default.aspx" />
            </Component>
            <Component Id="cmp827A8854133966F2160835E612413FA7" Directory="WebR.Content" Guid="{ADF5B995-9002-469F-BA2F-9A88621DAF13}">
                <File Id="filFD9C307A451419BA8B1308C1786045D2" Source="$(var.WebR.ProjectDir)\Web.config" />
            </Component>
            <Component Id="cmpF279DD78D3B3BE5386C8535E2A85FC5F" Directory="dirBB5AA78A6132241A7A39F7899E66D36C" Guid="{8BFCFDD6-E995-482D-9AA3-4EE8926E9CB0}">
                <File Id="filB2AF43969CEF48A8A2E362F2D8E5DD20" Source="$(var.WebR.ProjectDir)\Fold\F2.aspx" />
            </Component>
        </ComponentGroup>
    </Fragment>
</Wix>

我还没有对Product.wxs进行任何更改:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*" Name="RStp" Language="1033" Version="1.0.0.0" Manufacturer="Prive" UpgradeCode="cfbe56e5-e27a-42c3-af88-262956974943">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

        <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
        <MediaTemplate />

        <Feature Id="ProductFeature" Title="RStp" Level="1">
            <ComponentGroupRef Id="ProductComponents" />
        </Feature>
    </Product>

    <Fragment>
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder">
                <Directory Id="INSTALLFOLDER" Name="RStp" />
            </Directory>
        </Directory>
    </Fragment>

    <Fragment>
        <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
            <!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
            <!-- <Component Id="ProductComponent"> -->
                <!-- TODO: Insert files, registry keys, and other resources here. -->
            <!-- </Component> -->
        </ComponentGroup>
    </Fragment>
</Wix>
  1. 我需要做什么才能在 Frags.wxs 中包含 A.R.Facade?
  2. 我如何link把Frags.wxs变成Product.wxs?
  3. 如何修复错误 'Undefined preprocessor variable '$(var.WebR.TargetDir)' 更新 右键单击​​ RStp,添加参考,select Web prj - 固定
  4. 我必须在哪里添加蜡烛代码(RStp.wixproj 比如加热?)它应该是什么样子的?
  5. 如果这在源安全上,我是否应该将 Frags.wxs 包含到源中?
  6. 我需要一个如下所示的特定安装路径:'E:\Inetpub\wwwroot',我该如何设置?

谢谢

1.) 您需要在功能中引用 Components/ComponentGroups

    <Feature Id="ProductFeature" Title="RStp" Level="1">
        <ComponentGroupRef Id="Portals.Vendor" />
        <ComponentGroupRef Id="WebR.Content" />
        <ComponentGroupRef Id="WebR.Binaries" />
    </Feature>

2.) WiX 中没有传统意义上的链接。您的所有组件都可以从该项目中的其他 WiX 文件中引用。

3.) 在 Build 选项卡下的 RStp 的项目属性中,您可以将 WebR.TargetDir 定义为启动 heat 的目录路径

4.) 既然你已经在使用 Visual Studio 为什么不让它处理编译呢?

5.) 因为每次都会生成 Frags.xml,所以我不会将它添加到 Source Safe 中,因为它需要锁定文件才能对其进行编辑。我们使用 SVN 并添加了 autogen 文件,因为我们发现它在进行安装时查看已添加或删除的文件很有用。

6.) 看看this