John N supports a C# project that, on first run, needs to initialize a database. It pulls that data from a dbInstallFilePath
, controlled by the application .config file. This brings us to our representative line:
<add key="dbInstallDbFilePath" value="C:\TestData\" />
Isn't that just terrible? Aren't you just cringing, or calling for the responsible developer to be sacked? Oh, wait, you're sitting here, scratching your head, wondering about how this is a WTF, aren't you? Let me provide a little more context.
<!--
Stephen - 18th July 2013
##
## IMPORTANT - DON'T put a backslash at the end of the path below!!!!!
##
I don't know why, but it sometimes makes a difference that the DbFilePath config
has to be specified WITHOUT the trailing backslash
It seems that if a database is created using a path specifiecation that includes
a single backslash, and an attempt is made to restore the database in-place
(using WITH MOVE ... REPLACE), then it will fail if the restore command uses
double backslash in the path, and similarly, restoring a database that was created
with double backslash in the path will only restore safely if the restore
specifies double backslash.
REALLY DON'T PUT A BACKSLASH. EVER.
-->
<add key="dbInstallDbFilePath" value="C:\TestData\" />
[Advertisement]
BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!