Friday, January 23, 2015

Web Site Folders and Visual Studio Find and Replace

For many years I have used Visual Studio for Find (Ctrl+Shift+F) and Replace (Ctrl+Shift+H) in files. I know there are countless utilities of different styles available to do this, but if you have Visual Studio then it conveniently provides all of the typical power options you would need (Regex, match case, sub-folders, file name patterns, history, etc).

A few years ago I used Visual Studio to search through one of my Expression Web site folders, but it said "No files were found to look in". For half an hour I thought I'd gone mad, but I eventually deduced that folders with the S (System) attribute on are ignored. Later I found the easily missed caveat at the top of this MSDN Find in Files page. I did an attrib -S foldername and this makes the contents visible to Visual Studio again. However, read on...

If your Web Site uses the option "Maintain the site using hidden metadata files" then it uses hidden _vti_xxx folders to maintain a kind of database of the site contents and it uses a hidden desktop.ini file to give the folder a custom icon which is referenced as path _vti_pvt\fpdbw.ico. The custom icon only appears when the folder has the S attribute on and the hidden _vti files and desktop.ini file are being used and are correct.

It's a nuisance that Web Site folders have a peculiar and fragile management technique and they prevent Visual Studio searches. It's also a nuisance that the Windows Explorer folder properties page doesn't let you change the S attribute, you have to use the attrib command.