Is it possible to set an explicit lock on a file in TFS?
I do Schema Comparisons in Visual Studio 2010 when porting in SQL database changes during a check-in. Clicking on “Write Updates” brings in all the changes which includes automatically unlocking any modified files. This has been wonderful up until now. I have recently introduced a new FileStream file for the database which has brought with it some complications. I can not override the physical path for the File on a configuration profile basis, so I need to add a new SqlCmd Variable that I can specify the physical path on a configuration profile basis but need to alter the schema to use the variable instead of the string (The string of the physical path in my debug environment.)
From this:
ALTER DATABASE [$(DatabaseName)]
ADD FILE (NAME = [BlobStore], FILENAME = 'C:\SQLSERVER DATA\####\BlobStream') TO FILEGROUP [BlobStreamFileGroup];
To this:
ALTER DATABASE [$(DatabaseName)]
ADD FILE (NAME = [BlobStore], FILENAME = $(PathBlobStream)) TO FILEGROUP [BlobStreamFileGroup];
It doesn’t appear that I can do a reverse schema comparison to write this to the actual database on my debug environment so this is a forward integration thing only now. This means I will always have to skip the update of this schema difference in every future comparison and being a realist, I don’t like the idea of potentially breaking the build if I happen to forget about it.
Is there a way to lock this schema file in TFS so that it will never being automatically unlocked/updated unless I explicitly unlock it for that purpose?
You can create another workspace on your machine, and check it out into there (use a Check-In Lock – which allows other users to check it out, but not check it in).
Then just leave it checked out/locked in your other workspace indefinately.