2

RegistrySearchin WiX バンドルを使用してTextin テーマを非表示にすることは可能ですか? どこから始めればよいかわかりません。以下のコードでは、InstalledDotNet4変数は in time を無効に設定せず、無効にする(またはそのテキスト コンテンツを変更する)Text方法が見つかりません。Text

Bundle.wx:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
     xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
  <Bundle Name="My App" Version="1.0.0.0"
          Manufacturer="ACME"
          UpgradeCode="d88faa97-2197-4154-9e77-32f9ca773bd4">

  <BootstrapperApplicationRef
    Id="WixExtendedBootstrapperApplication.HyperlinkLicense">

    <Payload SourceFile="Resources/background.png" Id="myLogo" />

  </BootstrapperApplicationRef>

  <WixVariable Id="WixExtbaLicenseUrl" Value="" />
  <WixVariable Id="WixExtbaThemeXml" Value="Resources\MyTheme.xml" />
  <WixVariable Id="WixExtbaThemeWxl" Value="Resources\MyTheme.wxl" />

  <util:RegistrySearch Root="HKCU"
                       Key="Software\AnythingToCheck"
                       Value="Test" Variable="InstalledDotNet4" />

  <Chain>
     <MsiPackage Id="dotNETv4" DisplayName="My .NET v4 prerequisite"
                 SourceFile="myApp.msi" 
                 Visible="yes" 
                 InstallCondition="CheckboxDotNetv4" />
  </Chain>
</Wix>

MyTheme.xml:

<?xml version="1.0" encoding="utf-8"?>
<Theme xmlns="http://wixtoolset.org/schemas/thmutil/2010">
  <!-- Window definition -->
  <!-- Font definition -->

  <Page Name="Install">
    <Checkbox Name="CheckboxDotNet4"
              X="205" Y="126"
              Width="-100" Height="17"
              TabStop="yes" FontId="3"
              HideWhenDisabled="yes">.NET Framework 4.0</Checkbox>
    <Text Name="InstalledDotNet4"
          X="-10" Y="126"
          Width="80" Height="17"
          TabStop="no" FontId="3"
          HideWhenDisabled="yes">(Installed)</Text>
  </Page>

  <!-- More pages -->
</Theme>

さらに、Bundle.wxs で次のコードを使用しようとしましたが、次のコードにリンクされていませんRegistrySearch

<Variable Name="InstalledDotNet4State" Type="string" Value="disable" />
4

1 に答える 1

3

Textはい、広範な調査の結果、に基づいてを非表示にすることが可能であることがわかりましたRegistrySearchまず、 http: //wixextba.codeplex.com/からWiX Extended Bootstrapper Applicationをダウンロードする必要があります。内容を抽出し、例に示すようにプロジェクトに追加します。WixBalExtensionExt.dllBundle10.wxs

次に、bafunctionsフォルダーの下のプロジェクトを開きますTemplate bafunctions。この C++ ライブラリをコンパイルして、バンドルに として追加する必要がありますPayload(Bundle10.wxs例として を使用)。

次に、コントロールを読み取って非表示にできるようにするにはText、関数のコメントを解除OnDetectComplete()して、次のコードを追加します。たとえば、次のようになります。

STDMETHODIMP OnDetectComplete()
{
    HRESULT hr = S_OK;
    LPWSTR sczValue = NULL;

#if DEBUG
    // Show log info during debug.
    // May not be THE way to log.
    size_t i; 
    LPSTR sczValue2 = (char *) malloc(100);
#endif

    BalGetStringVariable(L"InstalledDotNet4Reg", &sczValue);
    BalExitOnFailure(hr, "Failed to get variable.");

    if (sczValue == NULL)
    {
        BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD,
            "Failed to read null variable.");
    }
    else
    {
        if (_wtoi(sczValue))
        {
            hr = m_pEngine->SetVariableString(L"CheckboxDotNetv4State",
                L"disable");
            BalExitOnFailure(hr, "Failed to set control state.");
            hr = m_pEngine->SetVariableNumeric(L"CheckboxDotNetv4", 0);
            BalExitOnFailure(hr, "Failed to set variable.");
        }
        else
        {
#if DEBUG
            // Log information
            wcstombs_s(&i, sczValue2, (size_t)100, sczValue, (size_t)100);
            BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, sczValue2);
#endif
            hr = m_pEngine->SetVariableString(L"InstalledDotNet4State",
                L"disable");
            BalExitOnFailure(hr, "Failed to set control state.");
            }
        }

LExit:
    ReleaseStr(sczValue);

    return hr;
}

最後に、次のように を変更 (または追加) しますRegistrySearch

<util:RegistrySearch Root="HKLM"
    Key="SOFTWARE\Classes\Installer\Products\FCDAC0A0AD874C333A05DC1548B97920"
    Variable="InstalledDotNet4Reg" Result="exists" />
于 2013-09-17T13:43:55.310 に答える