Getting path of file copied after deployment in a unit test C#

Posted by amitchd on Stack Overflow See other posts from Stack Overflow or by amitchd
Published on 2010-05-29T06:28:39Z Indexed on 2010/05/29 6:32 UTC
Read the original article Hit count: 189

Filed under:

Hi,

The connection string in my app.config for my C# project looks like

Data Source=.\SQLEXPRESS;AttachDbFilename='|DataDirectory|\EIC.mdf';Integrated Security=True;User Instance=True"

I am writing unit tests for the project and have the set the test run configuration to copy the EIC.mdf, but I do am not able to reference the Deployed copy of EIC.mdf to be referenced by the app.config I created for the test project. If I set it to

Data Source=.\SQLEXPRESS;AttachDbFilename='EIC.mdf';Integrated Security=True;User Instance=True"

It still does not find the mdf file.

© Stack Overflow or respective owner

Related posts about c#