2012-12-13 167 views
3

我正在用C#开发wpf应用程序。我在Visual Studio 2010中成功创建了wpf应用程序的安装项目。我将MS Access 2010用作数据库。它安装在所有电脑上都很好。但是在某些计算机上没有安装Microsoft Office,并且在某些计算机上安装了MS Office的较低版本,如MS Office 2003.当我在这些计算机上安装应用程序时,它会给我带来连接问题。你能告诉我我该怎么做?我是否需要在Visual Studio 2010安装项目中包含MS Access 2010的任何先决条件?如果有什么是他们以及如何包括他们?如何在未安装Office 2010的计算机上安装Visual Studio 2010安装项目和MS Access数据库?

回答

4

您migth能够使用 Microsoft Access Database Engine 2010 Redistributable

- 更新 -
要添加自定义的先决条件,你需要在这里创建一个引导程序包是一些说明: Creating Bootstrapper Packages
Deploying Custom made Visual Studio prerequisites using Bootstrapper Manifest Generator

- 更新2 -
对于64位实现s以下是来自Massood Khaari的评论。

+0

我应该如何将它添加到安装程序prereqisite的列表中? –

+0

我已将有关信息添加到我的答案 –

+2

@Shailesh Jaiswal:请注意,如果您使用MS Access数据库引擎2010,则您的应用程序将无法在64位Windows上运行。虽然有一个64位版本的引擎(AccessDatabaseEngine_x64.exe),除了将它们打包进行部署需要很多困难之外,它还要求在系统上不安装MS Office的32位产品,这是一个更大的问题。解决方法是,您使用32位版本的Access Database Engine 2010,并强制.NET应用程序以32位模式运行(例如,通过在Configuration Manager中选择x86平台);或者更好地替换MS Access以获得更好的选择。 –

5

我有同样的问题,但我已经为Microsoft Access数据库引擎2010创建了一个Bootstrapper软件包。我也包含在此软件包的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> 

LICENSE.TXT

For detail please Log on http://www.microsoft.com/en-us/download/details.aspx?id=13255 

注:我在我的Windows 7 x86机器,它已经测试作品完美。如果已经安装,它不会重新安装。我没有x64机器,所以我不知道它的产品代码。但我相信它也能起作用。它也从网站下载这个软件包,我测试过了。

如果您需要任何进一步的帮助或完整的引导程序包,请让我知道。

干杯。

相关问题