2015-09-25 33 views
1

我已经看到类似这样的问题,但他们似乎没有帮助我。Wix未定义的预处理器变量'

我与测试Web应用程序播放。

enter image description here

我加入到这个我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. 如何将Frags.wxs链接到Product.wxs?
  3. 如何修复错误“未定义的预处理器变量‘$(var.WebR.TargetDir)’UPDATE右键点击RSTP,添加引用,选择Web PRJ - 固定
  4. 我在哪里需要添加蜡烛代码(RStp.wixproj喜欢热吗?),应该是什么样子?
  5. 如果这将在sourcesafe上,我应该将Frags.wxs包含到源代码中吗?
  6. 我需要有一个特定的安装路径,看起来像这样:“E:\的Inetpub \ wwwroot文件”,我怎么能设置呢?

感谢

回答

2

1)你需要引用您的特性

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

2)有在维克斯传统意义上的无连接内部的组件/ ComponentGroups。您的所有组件都可以从该项目中的其他WiX文件中引用。

3)在RSTP的Build选项卡下的项目属性,你可以定义WebR.TargetDir是使热量在

4.既然你已经使用Visual Studio为什么不推出)的目录路径只是让它处理编译?

5.)由于Frags.xml将在每次我不会将其添加到Source Safe时生成,因此需要锁定该文件进行编辑。我们使用SVN并添加了自动生成的文件,因为我们发现在使用安装程序查看已添加或删除的文件时它非常有用。

6)看看this

+0

1.在重建,我得到新的Frags.wxs,所以我不能将其添加到Frags.wxs。我将它添加到Product.wxs中,什么都没发生。我究竟做错了什么? 2.好吧,我必须为Product.wxs中的Frags.wxs添加一些内容吗?这是怎么回事?它应该放在哪里? 3.我尝试了很多格式,例如:$(var.WebR.TargetDir)='C:\ something \'。 – Ash

+0

无论我改变(使用引号,双引号括号)它给我变量定义无效。变量定义的格式应该是-dname = value,其中的值是可选的。 4.确定 5.很有意义 6.看看这个,1-2-3后 – Ash

+0

@RickBowerman你的解决方案似乎与这[post](https://stackoverflow.com/q/47995549/ 1232087)。你有时间看帖子,给我你的建议吗?先谢谢你。 – nam