[wix-users] Deploying access database file with Wix

Habib Salim habib at hsalim.com
Fri Aug 18 09:28:03 PDT 2017


Your application has the connection string in two places.  Why?
the data source is XYZ.accdb in the first - which should resolve to the
application directory if I remember correctly.  Maybe you are not using
this
In the second case, you have "Source = |Data Directory| " which is not
valid.  Try changing that to the installed location.

You could use something like this to specify the location of your accdb
file

      <Component Id="cmpModifyApplicationConfig1" Guid="yourguid"
KeyPath="yes">
        <util:XmlConfig Id="editConnectionString"
                        File="[#$(var.ExeName).config]"
                        Action ="create"
                        On="install"
                        Node="value"
                        Name="connectionString"
 
Value="Provider=Microsoft.ACE.OLEDB.12.0;DataSource=[INSTALLFOLDER]\XYZ.ac
cdb;Persist Security Info=True;Jet OLEDB:Database Password=123"
 
ElementPath="//configuration/connectionStrings/add[\[]@name
='XYZ.Properties.Settings.XYZConnectionString'[\]]"
                        Sequence="1"/>
      </Component>




-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf
Of Roopendra Gowlikar
Sent: Friday, August 18, 2017 12:00 PM
To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
Subject: Re: [wix-users] Deploying access database file with Wix

Below is application.exe.config saying...

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
  </configSections>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/>
  </startup>
  <connectionStrings>
    <add name="CompanyXYZ"
connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=XYZ.accdb"
/>
    <add name="XYZ.Properties.Settings.connection" connectionString="Data
Source=ServerName;Initial Catalog=XYZ_DEV;Integrated Security=True"
      providerName="System.Data.SqlClient" />
    <add name="XYZ.Properties.Settings.XYZConnectionString"
connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=|DataDirectory|\XYZ.accdb;Persist Security Info=True;Jet
OLEDB:Database Password=123"
      providerName="System.Data.OleDb" />
  </connectionStrings>
  <appSettings>
    <add key="ShouldHostXYZWebAPI" value="true"/>
    <add key="IPAddress" value="localhost"/>
  </appSettings>
</configuration>

On Fri, Aug 18, 2017 at 9:20 AM, Habib Salim <habib at hsalim.com> wrote:

> How is your application connecting to the database?
> What does your application.exe.config file say?
>
>
> -----Original Message-----
> From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On 
> Behalf Of Roopendra Gowlikar
> Sent: Friday, August 18, 2017 8:52 AM
> To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
> Subject: Re: [wix-users] Deploying access database file with Wix
>
> Yeah, I did copied accdb file to installation location("C:\Program 
> Files
> (x86)\MyApplication")
> but after installation application is reading from "C:\Windows\System32"
> which wrong. I copied file to system32 folder too, till it says 
> access.accdb file can find.
>
> My application is windows application and accdb as database and app is 
> reading from application.exe.config.
> Each install has its own database. Below is my wix code
>
>
> <?define xyz_TargetDir=$(var.xyz.TargetDir)?>
>
>     <Feature Id="ProductFeature" Title="xyz" Level="1">
>       <ComponentGroupRef Id="ProductComponents" />
>       <ComponentRef Id="ApplicationShortcut" />
>       <ComponentRef Id="ApplicationShortcutDesktop" />
>     </Feature>
>
>   <Fragment>
>     <Directory Id="TARGETDIR" Name="SourceDir">
>       <Directory Id="ProgramFilesFolder">
>         <Directory Id="INSTALLFOLDER" Name="xyz" />
>       </Directory>
>       <Directory Id="ProgramMenuFolder">
>         <Directory Id="ApplicationProgramsFolder"
Name="xyz"></Directory>
>       </Directory>
>       <Directory Id="DesktopFolder" Name="Desktop"></Directory>
>     </Directory>
>   </Fragment>
>
> <Fragment>
> <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
>       <Component Id="xyz.accdb" Guid="GUID">
>         <File Id="xyz.accdb" Name="xyz.accdb"
> Source="$(var.xyz_TargetDir)xyz.accdb" />
>       </Component>
> </ComponentGroup>
> </Fragment>
>
>
> On Fri, Aug 18, 2017 at 8:25 AM, Habib Salim <habib at hsalim.com> wrote:
>
> > You can simply copy the mdb or accdb file just like other 
> > application dependencies/dlls.
> > How is your application referring to the access database?
> > Application.exe.config?
> > Are multiple users connecting to the one database or does each 
> > install have its' own database?
> >
> >
> > -----Original Message-----
> > From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On 
> > Behalf Of Roopendra Gowlikar
> > Sent: Friday, August 18, 2017 8:17 AM
> > To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
> > Subject: [wix-users] Deploying access database file with Wix
> >
> > Hello,
> >
> > Does anyone know how to deploy access database file using wix.
> > Any pointer would be greatly appreciated.
> >
> > Thanks
> >
> > ____________________________________________________________________
> > WiX Toolset Users Mailing List provided by FireGiant 
> > http://www.firegiant.com/
> >
> > ____________________________________________________________________
> > WiX Toolset Users Mailing List provided by FireGiant 
> > http://www.firegiant.com/
> >
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant 
> http://www.firegiant.com/
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant 
> http://www.firegiant.com/
>

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant
http://www.firegiant.com/



More information about the wix-users mailing list