title: How Do I make my Setup Project Include my Database (.sdf) file along with the winform application?
body: <p>I have created a Winforms application in VS 10 (C#), with SQL Server Compact Edition 3.5 as a back end.</p>
  
  <p>First I created a new setup project by following <a href="http://www.c-sharpcorner.com/UploadFile/deepak.sharma00/how-to-create-an-installer-for-a-winform-application-using-s/" rel="nofollow">these</a> steps.</p>
  
  <p>But I got <strong>database file could not be found</strong> exception on installing application on client's machine.</p>
  
  <p>Then I tried creating a setup project and included my database (.sdf) file in <strong>Application Folder</strong> and I got following exception: </p>
  
  <blockquote>
    <p>Internal error: Cannot open the shared memory region.</p>
  </blockquote>
  
  <p>I am getting the database file by following code :</p>
  
  <pre><code>SqlCeConnection con = new SqlCeConnection("DataSource=|DataDirectory|\\myDatabase.sdf");
  </code></pre>
  
  <p>And my <code>DataDirectory</code> is pointing to the <code>path</code></p>
  
  <pre><code>string path = AppDomain.CurrentDomain.BaseDirectory;
  AppDomain.CurrentDomain.SetData("DataDirectory", path);
  </code></pre>
  
  <p>Can anyone please help me including my database file?</p>