即使
BootstrapperPackage
Condition
属性,它将仅在编译时应用,这可能不是您想要的。
Microsoft.Visual.C++.14.0.x86
Microsoft.Visual.C++.14.0.x64
位于
C:\Program Files (x86)\Microsoft SDKs\ClickOnce Bootstrapper\Packages\vcredist_x86\product.xml
和
C:\Program Files (x86)\Microsoft SDKs\ClickOnce Bootstrapper\Packages\vcredist_x64\product.xml
分别地(他们可能也在
C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages
或任何其他版本的Windows SDK,具体取决于您的操作系统。发布应用程序时的生成日志可能会提到将先决条件从何处复制。)
在这些文件中,您会发现类似这样的部分(取自我的vcredist_x64清单)
<!-- These checks determine whether the package is to be installed -->
<InstallConditions>
<BypassIf Property="VCRedistInstalled" Compare="ValueGreaterThanOrEqualTo" Value="3"/>
<!-- Block install if user does not have admin privileges -->
<FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/>
<!-- Block install on any platform other than x64 -->
<FailIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="AMD64" String="InvalidOS"/>
<!-- Block install on Vista or below -->
<FailIf Property="VersionNT" Compare="VersionLessThan" Value="6.00" String="InvalidPlatformWinNT"/>
</InstallConditions>
<FailIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="AMD64" String="InvalidOS"/>
修改为
<BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="AMD64"/>
InstallConditions
<BypassIf Property="ProcessorArchitecture" Compare="ValueEqualTo" Value="AMD64"/>
相关阅读: