代码之家  ›  专栏  ›  技术社区  ›  MikeBaz - MSFT

帮助确保使用引导程序,但可以进行升级

  •  0
  • MikeBaz - MSFT  · 技术社区  · 15 年前

    我们在wix 3.5.2030.0中编写了一个MSI,目标是Windows Installer 4.0(用于 MSIUSEREALADMINDETECTION 支持)。我们在MSI中定义了一个属性来强制使用引导程序(我说的是“强制”,但它确实“非常强烈地鼓励”当然):

    <Property Id="SETUPEXE"
              Secure="yes" />
    <Condition Message="You must run the MSI through the setup program; you cannot run it directly.">
      SETUPEXE = 1
    </Condition>
    

    当我们将生成的MSI作为新安装运行时,一切都正常。但是,当我们将其作为升级运行时,传递给安装程序的属性在某个时刻似乎“丢失”。日志显示以下相关条目:

    MSI (s) (2C:8C) [11:27:41:648]: Command Line: SETUPEXE=1 <other properties>
    
    MSI (s) (2C:8C) [11:27:43:055]: PROPERTY CHANGE: Adding SETUPEXE property. Its value is '1'.
    
    MSI (s) (2C:CC) [11:28:11:038]: PROPERTY CHANGE: Adding NETFRAMEWORK20INSTALLROOTDIR property. Its value is 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\'.
    Action ended 11:28:11: AppSearch. Return value 1.
    MSI (s) (2C:CC) [11:28:11:147]: Doing action: LaunchConditions
    Action start 11:28:11: LaunchConditions.
    MSI (s) (2C:CC) [11:28:33:662]: Product: <product> -- You must run the MSI through the setup program; you cannot run it directly.
    
    Action ended 11:28:33: LaunchConditions. Return value 3.
    Action ended 11:28:33: INSTALL. Return value 3.
    
    Property(N): SETUPEXE = 0
    
    Property(N): SecureCustomProperties = NETFRAMEWORK20INSTALLROOTDIR;NETFRAMEWORK35;NETFRAMEWORK35_SP_LEVEL;NEWERVERSIONDETECTED;OLDERVERSIONBEINGUPGRADED;SETUPEXE
    
    Property(S): SecureCustomProperties = NETFRAMEWORK20INSTALLROOTDIR;NETFRAMEWORK35;NETFRAMEWORK35_SP_LEVEL;NEWERVERSIONDETECTED;OLDERVERSIONBEINGUPGRADED;SETUPEXE
    
    Property(S): SETUPEXE = 1
    

    我在这个上面做了一些搜索并查看了登录信息 WiLogUtl 至少已经知道了 Property(N) 表示“嵌套”属性,但当我直接通过 msiexec . 那么,当客户机和服务器值正确时,我不知道为什么嵌套属性设置不正确。如何解决此问题?

    1 回复  |  直到 15 年前
        1
  •  0
  •   Christopher Painter    15 年前

    我会考虑将该条件更改为(或类似情况,取决于您的用例)

    <Condition Message="Blah blah blah">SETUPEXE or Installed</Condition> 
    

    我做了类似的事情(默认情况下,installshield setup.exe会传递一个setupexedir属性),如果你想确保你的安装程序是通过引导程序运行的,以确保prereq有机会被安装,这不是一件可怕的事情。但对于维护/修复/卸载方案,您可能不希望运行setup.exe。