首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何防止在Wix包中使用Miniconda的重复安装?

如何防止在Wix包中使用Miniconda的重复安装?
EN

Stack Overflow用户
提问于 2022-02-08 15:25:45
回答 1查看 78关注 0票数 0

我正在开发一个调用python脚本的.NET应用程序(及其安装程序)。为了做到这一点,不仅需要安装应用程序,还需要安装米尼康达。但是,当应用程序有更新时,当应用程序已经可用时,不应该再次安装它。

我试图做到这一点,但我没有成功。这是我的Bundle.wxs (我正在使用WiX3.11)。

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:bal="http://schemas.microsoft.com/wix/BalExtension"
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">

    <?include ..\InstallPlugin\Forwards.wxi?>

    <Bundle
        Name="$(var.ProductTitle)"
        Version="$(var.ProductVersion)"
        Manufacturer="$(var.ProductCompany)"
        Copyright="$(var.ProductCopyright)"
        DisableModify="yes"
        DisableRemove="yes"
        IconSourceFile="../Images/Icon.ico"
        UpgradeCode="f8b6f347-2832-41c9-9d89-112144f62ed8"
        >

        <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.HyperlinkSidebarLicense">
            <Payload SourceFile="..\Deployment\Bootstrapper\bin\Release\net462\Bootstrapper.dll"/>
            <Payload Name="BootstrapperCore.config" SourceFile="..\Deployment\Bootstrapper\Bootstrapper.BootstrapperCore.config"/>
            <Payload Name="en-US\License.rtf" SourceFile="../Licenses/License.en-US.rtf"/>
            <Payload SourceFile="../Images/Logo.png"/>
            <bal:WixStandardBootstrapperApplication
                LicenseUrl="https://SOMETHING"
                ShowVersion="yes" />
        </BootstrapperApplicationRef>

        
        <Chain>
            <PackageGroupRef Id="PluginSystem" />
            <MsiPackage SourceFile="..\InstallPlugin\bin\Release\en-US\InstallPlugin.msi"
                        Compressed="yes"
                        DisplayInternalUI="no"
                        Vital="yes"
                        Visible="yes"
            >
                <!-- <MsiProperty Name="USERLANGUAGE" Value="[UserLanguage]"/> -->
                <MsiProperty Name="USERLANGUAGE" Value="en-US"/>
            </MsiPackage>
            <ExePackage Id="MiniConda"
                        SourceFile="C:\\AnaCondaDependencies\\Miniconda3-py39_4.10.3-Windows-x86_64.exe"
                        DetectCondition="CondaFileFound"
                >
                <ExitCode Value ="3010" Behavior="success" />
            </ExePackage>
        </Chain>
    </Bundle>

    <Fragment>
    <util:RegistrySearchRef Id="CondaFound" />
    <util:FileSearchRef Id="CondaFileFound" />
      <util:RegistrySearch
       Id="CondaFound"
       Root="HKLM" Key="SOFTWARE\Python\ContinuumAnalytics\SupportUrl" Value="https://github.com/continuumio/anaconda-issues"
       Result="exists" Variable="CondaFound" />
    
     <util:FileSearch
       Id="CondaFileFound"
       Path="[CommonAppDataFolder]Miniconda3\python39.dll"
       Variable="CondaFileFound"
       Result="exists" />
    </Fragment>
</Wix>

从上面显示的.wxs文件中可以清楚地看出,我定义了两个条件:CondaFileFoundCondaFound作为DetectCondition使用。两人都不是为我工作的。安装程序只是启动Miniconda安装程序,即使Miniconda已经安装,我的条件也会对此进行检查。这真是令人沮丧。我做错了什么?我怎么才能解决这个问题?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-02-10 13:35:18

正如鲍勃已经提到的,您正在将RegistrySeach和FileSearch函数调用与定义的片段放在同一个片段中,这并不是从Bundle执行它们。

您必须将RegistrySearchRef和FileSearchRef移到Bundle定义中。

请参阅下面的测试包。

代码语言:javascript
复制
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
  <Bundle Name="Bootstrapper1" Version="1.0.0.0" Manufacturer="cccc" UpgradeCode="b8a7411a-68dc-40a9-9557-d7f64c2e7940">
    <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
    <util:FileSearchRef Id="searchCmd"/>
    <Chain>
      <ExePackage SourceFile="c:\temp\cmd.exe"  DetectCondition="detected"/>
    </Chain>
  </Bundle>
  <Fragment>
    <util:FileSearch
           Id="searchCmd"
           Path="[WindowsVolume]temp\cmd.exe"
           Variable="detected"
            />
  </Fragment>
</Wix>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71036457

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档