記事に従って、Excel アドイン プロジェクトのセットアップ プロジェクトを作成しました。
Windows インストーラーを使用して 2007 Microsoft Office System 用の Office System 3.0 ソリューション用の Visual Studio ツールを展開する
http://msdn.microsoft.com/en-us/library/cc563937(office.12).aspx
2007 Interop アセンブリ (Office2007PIA) などの前提条件を追加し、セットアップ ファイルを実行するとインストールされます。しかし、問題は次のとおりです。コンピューターに Office2007PIA が既にインストールされている場合でも、セットアップによって常にインストールされます。
Office2007PIA がインストールされているかどうかを最初に確認し、Office2007PIA をインストールせずにプロジェクトのインストールを続行するようにセットアップ プロジェクトを構成するにはどうすればよいですか?
「c:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\Office2007PIA\en\package.xml」のコードは次のとおりです。
<Package
xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
Name="DisplayName"
Culture="Culture"
>
<!-- Defines a localizable string table for error messages. -->
<Strings>
<String Name="DisplayName">2007 Microsoft Office Primary Interop Assemblies</String>
<String Name="Culture">en</String>
<String Name="AdminRequired">Administrator permissions are required to install the 2007 Microsoft Office Primary Interop Assemblies. Contact your administrator.</String>
<String Name="GeneralFailure">A failure occurred attempting to install Microsoft Office 2003 primary interop assemblies.</String>
</Strings>
</Package>
そして、「c:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\Office2007PIA\en\package.xml」「c:\Program Files (x86)\Microsoft SDKs\」のコードは次のとおりです。 Windows\v6.0A\Bootstrapper\Packages\Office2007PIA\product.xml":
<Product
xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
ProductCode="Microsoft.Office.PIA.2007"
>
<RelatedProducts>
<DependsOnProduct Code="Microsoft.Net.Framework.2.0" />
</RelatedProducts>
<!-- Defines the list of files to be copied on build. -->
<PackageFiles>
<PackageFile Name="o2007pia.msi"/>
<PackageFile Name="ComponentCheck.exe"/>
</PackageFiles>
<InstallChecks>
<ExternalCheck
Property="Office2007Exists"
PackageFile="ComponentCheck.exe"
Arguments="{0638C49D-BB8B-4CD1-B191-050E8F325736}"/>
</InstallChecks>
<!-- Defines how to run the Setup package. -->
<Commands Reboot="Defer">
<Command PackageFile="o2007pia.msi"
Arguments=""
EstimatedInstalledBytes="30000000"
EstimatedInstallSeconds="60"
>
<InstallConditions>
<BypassIf Property="Office2007Exists" Compare="ValueNotEqualTo" Value="0" />
<FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/>
</InstallConditions>
<ExitCodes>
<ExitCode Value="0" Result="Success"/>
<ExitCode Value="1641" Result="SuccessReboot"/>
<ExitCode Value="3010" Result="SuccessReboot"/>
<DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
</ExitCodes>
</Command>
</Commands>
</Product>
product.xml にコードがありません (ノードInstallConditions内):
<BypassIf Property="PIAInstallAction" Compare="ValueNotEqualTo" Value="0" />
?