2012-12-13 166 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機器,所以我不知道它的產品代碼。但我相信它也能起作用。它也從網站下載這個軟件包,我測試過了。

如果您需要任何進一步的幫助或完整的引導程序包,請讓我知道。

乾杯。

相關問題