title: using a SQL database in multiple projects
body: <p>I have a system comprising 5 applications.  Each app accesses a database via a DAL library.  In the DAL i have an app.config with the following entry:</p>
  
  <pre><code>&lt;connectionStrings&gt;
  &lt;add name="DataAccessLayer.Properties.Settings.ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=c:\users\something\something\MyDB.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True" providerName="System.Data.SqlClient" /&gt;
  &lt;/connectionStrings&gt;
  </code></pre>
  
  <p>Using the full path for the attachDbFilename works fine.  But I'm not happy:</p>
  
  <ol>
  <li><p>I have copied the app.config file into each app that uses the database.  Best way of doing this - copying the DAL app.config as a Link in the other projects? </p></li>
  <li><p>I dont want a full path, when it comes to deployment that aint going to work.  Relative paths in the app.config do not appear to work.  Ideally I would like to be able to pull the DAL from source control onto any computer and not have to worry about changing the connection string each time.  This: <a href="http://blogs.msdn.com/b/smartclientdata/archive/2005/08/26/456886.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/b/smartclientdata/archive/2005/08/26/456886.aspx</a> talks about |DataDirectory| for deployment purposes but this doesn't work for me in debug (unless I'm using it wrong, see 3)</p></li>
  <li><p>This might be better as a separate question but it is related to 2. - Is there a "good" way of arranging multiple projects for debug?  I have created a Bin dir and in each project settings I copy the dll/exe to this bin dir.  I also have a copy of the database in here (I tried no path in the app.config but that didn't work either, nor did |DataDirectory|).  Also incredibly annoying is that relative paths do not work in Debug\Working Directory setting either, so it looks like that is one place that would have to change each time code is checked out to a new machine?</p></li>
  </ol>
  
  <p>Apologies for the war and peace and thanks in advance for any ideas.</p>