wpf 如何在未安装 Office 2010 的计算机上安装带有 MS Access 数据库的 Visual Studio 2010 安装项目?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13854698/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to install visual studio 2010 setup project with MS Access database on a computer which is not having Office 2010 installed?
提问by Shailesh Jaiswal
I am developing wpf application in C#. I have successfully created the setup project for wpf application in visual studio 2010. I have used MS Access 2010 as a database. It install fine on all computers. But on some computer there is no Microsoft Office installed and on some computer there is lower version of MS Office like MS Office 2003. When I install my application on these computers it gives me connectivity issues. Can you please tell me what should I need to do ? Should I need to include any prerequisite for MS Access 2010 in visual studio 2010 setup project ? If there is any which are they and how to include them ?
我正在用 C# 开发 wpf 应用程序。我已经在 Visual Studio 2010 中成功创建了 wpf 应用程序的安装项目。我使用 MS Access 2010 作为数据库。它可以在所有计算机上正常安装。但是在某些计算机上没有安装 Microsoft Office,而在某些计算机上有较低版本的 MS Office,如 MS Office 2003。当我在这些计算机上安装我的应用程序时,它给我带来了连接问题。你能告诉我我需要做什么吗?我是否需要在 Visual Studio 2010 安装项目中包含 MS Access 2010 的任何先决条件?如果有的话,它们是什么以及如何包含它们?
回答by Hossain Zahour
I had same problem but I have already created a Bootstrapper package for Microsoft Access Database Engine 2010. I've also included in this package x64 version of it. So it should work on 64 machine also. To include any Prerequisites you must have to add a Bootstrapper Package of that. After that you can get that in your Prerequisite list. That already you know I think. To build a Bootstrapper you need 2 manifest XML files. 1 is product.xml and another is package.xml right? I'm writing all the XML script below.
我遇到了同样的问题,但我已经为 Microsoft Access 数据库引擎 2010 创建了一个 Bootstrapper 包。我也将它的 x64 版本包含在这个包中。所以它也应该在 64 位机器上工作。要包含任何先决条件,您必须添加一个 Bootstrapper 包。之后,您可以在先决条件列表中获得它。你已经知道我想。要构建 Bootstrapper,您需要 2 个清单 XML 文件。1 是 product.xml 而另一个是 package.xml 对吗?我正在编写下面的所有 XML 脚本。
PRODUCT 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>
PACKAGE XML:
包 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>
license.txt
许可证.txt
For detail please Log on http://www.microsoft.com/en-us/download/details.aspx?id=13255
Note: I've already tested in my Windows 7 x86 Machine and it works perfect. It doesn't reinstall if already installed. I've no x64 machine so I don't know the Product code of it. But I'm sure it'll work too. It also downloads this package from website and I've tested that.
注意:我已经在我的 Windows 7 x86 机器上进行了测试,它运行完美。如果已经安装,则不会重新安装。我没有 x64 机器,所以我不知道它的产品代码。但我相信它也会奏效。它还从网站下载这个包,我已经测试过了。
If you need any further help or complete Bootstrapper Package just let me know.
如果您需要任何进一步的帮助或完成 Bootstrapper 包,请告诉我。
Cheers.
干杯。
回答by Jens Granlund
You migth be able to use Microsoft Access Database Engine 2010 Redistributable
您可能能够使用 Microsoft Access Database Engine 2010 Redistributable
-- Update --
To add custom prerequisites you need to create a Bootstrapper Package here are some instructions:
Creating Bootstrapper Packages
Deploying Custom made Visual Studio prerequisites using Bootstrapper Manifest Generator
-- 更新 --
要添加创建引导程序包所需的自定义先决条件,这里有一些说明:
创建引导程序包
使用引导程序清单生成器部署自定义的 Visual Studio 先决条件
-- Update 2 --
For 64-bit implementations see comment from Massood Khaari below.
-- 更新 2 --
对于 64 位实现,请参阅下面来自 Massood Khaari 的评论。

