如何在未安装Office 2010的计算机上安装带有MS Access数据库的Visual Studio 2010安装项目?

Sha*_*wal 3 c# wpf installation ms-access-2010

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

小智 5

我有同样的问题,但我已经为Microsoft Access数据库引擎2010创建了一个Bootstrapper包.我还包含在这个包x64版本中.所以它应该也适用于64机器.要包含任何先决条件,您必须添加它的Bootstrapper包.之后,您可以在先决条件列表中获取该内容.我想你已经知道了.要构建Bootstrapper,您需要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>
Run Code Online (Sandbox Code Playgroud)

包装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>
Run Code Online (Sandbox Code Playgroud)

LICENSE.TXT

For detail please Log on http://www.microsoft.com/en-us/download/details.aspx?id=13255
Run Code Online (Sandbox Code Playgroud)

注意:我已经在我的Windows 7 x86机器上进行了测试,它完美无缺.如果已安装,则不会重新安装.我没有x64机器,所以我不知道它的产品代码.但我相信它也会奏效.它也从网站上下载这个包,我已经测试过了.

如果您需要任何进一步的帮助或完成Bootstrapper Package,请告诉我.

干杯.