How can I get “Copy to Output Directory” to work with Unit Tests?

http://stackoverflow.com/questions/227545/how-can-i-get-copy-to-output-directory-to-work-with-unit-tests

In VS2010 this is: Test/Edit Test Settings/local, then in the list, select "Deployment", check the "Enable..." box and add the file(s).Marcel Jun 16 '10 at 12:54

http://technet.microsoft.com/zh-cn/library/cc716756.aspx

 |DataDirectory| 解析为“<应用程序根目录>

http://stackoverflow.com/questions/13275054/ef5-cannot-attach-the-file-0-as-database-1

DataException->EntityException->SqlException:
Cannot attach the file ‘{0}' as database '{1}'

 

Alright.

I have no clue what's so great about the clunky LocalDB. Anyway my solution was simple, I changed to use local server:

I changed the DataSource attribute in the connection string from:

Data Source=(LocalDb)\v11.0;blah

To:

Data Source=.\SQLEXPRESS;blah
原文地址:https://www.cnblogs.com/baiyu/p/3032836.html