【问题标题】:How to install visual studio 2010 setup project with MS Access database on a computer which is not having Office 2010 installed?如何在未安装 Office 2010 的计算机上安装带有 MS Access 数据库的 Visual Studio 2010 安装项目?
【发布时间】:2012-12-01 00:56:08
【问题描述】:

我正在用 C# 开发 wpf 应用程序。我已经在 Visual Studio 2010 中成功创建了 wpf 应用程序的安装项目。我使用 MS Access 2010 作为数据库。它可以在所有计算机上正常安装。但是在某些计算机上没有安装 Microsoft Office,并且在某些计算机上安装了较低版本的 MS Office,例如 MS Office 2003。当我在这些计算机上安装我的应用程序时,它给我带来了连接问题。你能告诉我我需要做什么吗?我是否需要在 Visual Studio 2010 安装项目中包含 MS Access 2010 的任何先决条件?如果有的话,它们是什么以及如何包含它们?

【问题讨论】:

    标签: c# wpf installation ms-access-2010


    【解决方案1】:

    我遇到了同样的问题,但我已经为 Microsoft Access Database Engine 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>
    

    许可证.txt

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

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

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

    干杯。

    【讨论】:

      【解决方案2】:

      您可以使用 Microsoft Access Database Engine 2010 Redistributable

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

      -- 更新 2 --
      对于 64 位实现,请参阅下方 Massood Khaari 的评论。

      【讨论】:

      • 我应该如何将它添加到设置先决条件列表中?
      • @Shailesh Jaiswal:请注意,如果您使用 MS Access 数据库引擎 2010,您的应用程序将无法在 64 位 Windows 上运行。虽然有64位版本的引擎(AccessDatabaseEngine_x64.exe),但除了打包部署有很多困难外,还需要在系统上不安装MS Office的32位产品,这是一个更大的问题。解决方法是您使用 32 位版本的 Access Database Engine 2010 并强制您的 .NET 应用程序以 32 位模式运行(例如,通过在配置管理器中选择 x86 平台);或者更好的是你用更好的替代品替换 MS Access。
      • @Massood Khaari,这就是我所做的,使用 32 位版本的 MS Access 数据库引擎 2010 并以 32 位模式运行应用程序(目标平台 x86)
      • 好的,谢谢。我只是想警告 Shailesh 和其他有类似问题的人关于这种限制,因为一个应用程序可能有其他依赖项,需要 64 位平台才能正常工作。
      • 好的,感谢您提供的信息,我在答案中添加了注释以阅读您的评论。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-02-01
      • 1970-01-01
      • 2011-03-02
      • 2011-02-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多