在VS 2008安装/部署项目中,有没有办法添加自定义错误对话框(或自定义现有错误对话框)来处理安装过程中遇到的错误?
答案 0 :(得分:1)
如果我理解正确的话:
不完全适用于您的软件,但您可以处理软件先决条件的错误,这些错误在大多数情况下会导致错误。您必须先转到必备软件包文件的位置。通常,这将是“C:\ Program Files \ Microsoft SDKs \ Windows \ v6.0A \ Bootstrapper \ Packages \”。找到你的包文件夹,移入,有一个名为“en”的文件夹,里面有一个名为“package.xml”的xml文件。用文本编辑器打开它,你会看到:
<InstallChecks>
<RegistryCheck Property="DotNet35SP" Key="HKLM\Software\Microsoft\NET Framework Setup\NDP\v3.5" Value="SP" />
</InstallChecks>
<!-- Defines how to invoke the setup for .NET Framework redist -->
<Commands Reboot="Defer">
<Command PackageFile="dotNetFx35setup.exe"
Arguments=' /lang:enu /passive /norestart'
EstimatedInstalledBytes="30000000"
EstimatedTempBytes="30000000">
<!-- These checks determine whether the package is to be installed -->
<InstallConditions>
<!-- This indicates .NET Framework is already installed -->
<BypassIf Property="DotNet35SP" Compare="ValueGreaterThanOrEqualTo" Value="1"/>
<!-- Block install if user does not have admin privileges -->
<FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/>
<!-- Block install on less than Windows XP SP2 -->
<FailIf Property="VersionNT" Compare="VersionLessThan" Value="5.1.2" String="InvalidPlatformWinNT"/>
<!-- Block install on W2K3 with no service pack -->
<FailIf Property="VersionNT" Compare="VersionEqualTo" Value="5.2.0" String="InvalidPlatformWinNT"/>
<!-- Block install if the platform is IA-64 -->
<FailIf Property="ProcessorArchitecture" Compare="ValueEqualTo" Value="IA64" String="InvalidPlatformArchitecture" />
</InstallConditions>
<ExitCodes>
<ExitCode Value="0" Result="Success"/>
<ExitCode Value="1602" Result="Fail" String="UserCancelled"/>
<ExitCode Value="1603" Result="Fail" String="GeneralFailure"/>
<ExitCode Value="3010" Result="SuccessReboot"/>
<DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
</ExitCodes>
</Command>
</Commands>
<!-- Defines a localizable string table for error messages-->
<Strings>
<String Name="DisplayName">.NET Framework 3.5 SP1</String>
<String Name="Culture">en</String>
<String Name="AdminRequired">Administrator permissions are required to install .NET Framework 3.5 SP1. Contact your administrator.</String>
<String Name="InvalidPlatformWinNT">Installation of the .NET Framework 3.5 SP1 requires Windows XP SP2, Windows 2003 SP1, Windows Vista, or later. Contact your application vendor.</String>
<String Name="InvalidPlatformArchitecture">This version of the .NET Framework 3.5 SP1 is not supported on an IA-64 operating system. Contact your application vendor.</String>
<String Name="UserCancelled">The user has cancelled the installation. .NET Framework 3.5 SP1 has not been installed.</String>
<String Name="GeneralFailure">A failure occurred attempting to install .NET Framework 3.5 SP1.</String>
<String Name="DotNetFX35SP1Exe">http://go.microsoft.com/fwlink/?linkid=118076</String>
</Strings>
在“InstallConditions”标记之间,您可以添加/删除先决条件安装的条件。然后在“strings”标记之间,您可以自定义错误消息。
了解更多信息:http://msdn.microsoft.com/en-us/library/ms229223.aspx
答案 1 :(得分:0)
您可以添加其他对话框,但我不认为有一种方法可以将错误重定向到它们。使用Studio安装项目,我认为你会遇到内置的错误处理。
您需要使用第三方产品(如InstallShield),或手动编辑安装程序(MSI)以获得所需的功能。