我正在用 C# 开发 wpf 应用程序。我已经在 Visual Studio 2010 中成功创建了 wpf 应用程序的安装项目。我使用 MS Access 2010 作为数据库。它可以在所有计算机上正常安装。但是在某些计算机上没有安装 Microsoft Office,并且在某些计算机上安装了 MS Office 2003 等较低版本的 MS Office。当我在这些计算机上安装我的应用程序时,它给我带来了连接问题。你能告诉我我需要做什么吗?我是否需要在 Visual Studio 2010 安装项目中包含 MS Access 2010 的任何先决条件?如果有的话,它们是什么以及如何包含它们?
2 回答
我遇到了同样的问题,但我已经为 Microsoft Access Database Engine 2010 创建了一个引导程序包。我还包含在这个包的 x64 版本中。所以它也应该在 64 机器上工作。要包含任何先决条件,您必须添加一个引导程序包。之后,您可以在先决条件列表中获得它。你已经知道我的想法了。要构建引导程序,您需要 2 个清单 XML 文件。1 是 product.xml,另一个是 package.xml 对吗?我正在编写下面的所有 XML 脚本。
产品 XML:
<Product
xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
ProductCode="Access.Database.Engine.2010"
>
<!-- Defines list of files to be copied on build -->
<PackageFiles CopyAllPackageFiles="false">
<PackageFile Name="AccessDatabaseEngine.exe" HomeSite="http://download.microsoft.com/download/2/4/3/24375141-E08D-4803-AB0E-10F2E3A07AAA/AccessDatabaseEngine.exe" />
<PackageFile Name="AccessDatabaseEngine_x64.exe" HomeSite="http://download.microsoft.com/download/2/4/3/24375141-E08D-4803-AB0E-10F2E3A07AAA/AccessDatabaseEngine_x64.exe" />
</PackageFiles>
<RelatedProducts>
<DependsOnProduct Code="Microsoft.Net.Framework.2.0" />
</RelatedProducts>
<InstallChecks>
<MsiProductCheck Property="IsInstalled"
Product="{90140000-00D1-0409-0000-0000000FF1CE}"/>
</InstallChecks>
<Commands>
<Command PackageFile="AccessDatabaseEngine.exe"
Arguments='/passive'>
<!-- These checks determine whether the package is to be installed -->
<InstallConditions>
<!-- ByPass if the Processor is not x86 -->
<BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="Intel"/>
<!-- ByPass if we have installed -->
<BypassIf Property="IsInstalled" Compare="ValueGreaterThan" Value="0" />
<!-- Block install if user does not have admin privileges -->
<FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/>
<!-- Block install on Win95 -->
<FailIf Property="Version9x" Compare="VersionLessThan" Value="4.10" String="InvalidPlatformWin9x"/>
<!-- Block install on NT 4 or less -->
<FailIf Property="VersionNT" Compare="VersionLessThan" Value="5.00" String="InvalidPlatformWinNT"/>
</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>
<Command PackageFile="AccessDatabaseEngine_x64.exe"
Arguments='/passive'>
<!-- These checks determine whether the package is to be installed -->
<InstallConditions>
<!-- ByPass if the Processor is not x64 -->
<BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="AMD64"/>
<!-- ByPass if we have installed -->
<BypassIf Property="IsInstalled" Compare="ValueGreaterThan" Value="0" />
<!-- Block install if user does not have admin privileges -->
<FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/>
<!-- Block install on Win95 -->
<FailIf Property="Version9x" Compare="VersionLessThan" Value="4.10" String="InvalidPlatformWin9x"/>
<!-- Block install on NT 4 or less -->
<FailIf Property="VersionNT" Compare="VersionLessThan" Value="5.00" String="InvalidPlatformWinNT"/>
</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>
包装 XML:
<?xml version="1.0" encoding="utf-8" ?>
<Package
xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
Name="DisplayName"
Culture="Culture"
LicenseAgreement="license.txt"
>
<PackageFiles>
<PackageFile Name="license.txt"/>
</PackageFiles>
<!-- Defines a localizable string table for error messages and url's -->
<Strings>
<String Name="DisplayName">Microsoft Access database engine 2010 (x86, x64)</String>
<String Name="Culture">en</String>
<String Name="DotNetFxRequired">Installation of Microsoft Access database engine 2010 requires Microsoft .NET Framework 2.0. Contact your application vendor.</String>
<String Name="InvalidPlatformWin9x">Installation of Microsoft Access database engine 2010 is not supported on Windows 95. Contact your application vendor.</String>
<String Name="InvalidPlatformWinNT">Installation of Microsoft Access database engine 2010 is not supported on Windows NT 4.0. Contact your application vendor.</String>
<String Name="GeneralFailure">A fatal error occurred during the installation of Microsoft Access database engine 2010.</String>
<String Name="AdminRequired">You do not have the permissions required to install this application. Please contact your administrator.</String>
</Strings>
</Package>
许可证.txt
For detail please Log on http://www.microsoft.com/en-us/download/details.aspx?id=13255
注意:我已经在我的 Windows 7 x86 机器上进行了测试,它运行良好。如果已经安装,它不会重新安装。我没有 x64 机器,所以我不知道它的产品代码。但我相信它也会起作用。它还从网站下载这个包,我已经测试过了。
如果您需要任何进一步的帮助或完成引导程序包,请告诉我。
干杯。
您可以使用 Microsoft Access Database Engine 2010 Redistributable
-- 更新 --
要添加自定义先决条件,您需要创建一个引导程序包,这里有一些说明:
创建引导程序包
使用引导程序清单生成器部署自定义的 Visual Studio 必备项
-- 更新 2 --
对于 64 位实现,请参阅下面 Massood Khaari 的评论。