Hello there,
I have experimented with disabling IntelliSense.
Here is a little tool I came up with that I use to lock the NCB file before starting Visual Studio. VS then tells me it has to disable IntelliSense because it cannot write the file. The tool also truncates the NCB file to zero length to clean away earlier rubbish.
The advantages I see with it is:
a) no need to hunt for .ncb files in %TEMP% directories to lock them
b) no need to muck about in your Visual Studio Installation
c) if you find out the disabled IntelliSense actually causes some problem, you can re-enable it with no effort
// Use this tool at your own risk.
//
// The program is provided as is without any guarantees
// or warranty. Although I have attempted to find
// and correct any bugs in it, I am not responsible for
// any damage or losses of any kind caused by the use
// or misuse of the program.
#include "stdafx.h"
#include <windows.h>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
int hitMe(int retval);
int hitMe(int retval)
{
printf(retval == 0 ? "Press any key to release the file.\\n" : "Press any key to continue.\\n");
_getch();
return retval;
}
//int _tmain(int argc, _TCHAR* argv[])
int main(int argc, char * argv[])
{
if(argc < 2)
{
printf("No file given.\\n");
return hitMe(1);
}
FILE *f;
char *fileName = argv[1];
int fileNameLen = strlen(fileName);
if(fileNameLen < 4)
{
printf("Given file '%s' is too short.\\n", fileName);
return hitMe(1);
}
if(strcmp(fileName + fileNameLen - 4, ".sln") == 0)
{
// We leak this in the end, but do not care about it just now.
fileName = new char[fileNameLen + 1];
strncpy_s(fileName, fileNameLen + 1, argv[1], fileNameLen - 3);
strcpy_s(fileName + fileNameLen - 3, 4, "ncb");
}
if(strcmp(fileName + fileNameLen - 4, ".ncb") != 0)
{
printf("Given file '%s' is neither an SLN nor an NCB.\\n", fileName);
return hitMe(1);
}
errno_t e = fopen_s(&f, fileName, "w+"); // watch out, this will remove the file's content!
printf("Locking file '%s' (open + delete content).\\n", fileName);
if(e != 0)
{
printf("Watch out; fopen returned error %d.\\n", e);
return hitMe(1);
}
hitMe(0);
printf("Releasing file '%s' (close).\\n", fileName);
if(f)
fclose(f);
return 0;
}
One way to use the tool is to simply open the .ncb file with it. I have actually registered it for .ncb files, so double clicking them works a charm. Alternatively you open the .sln file which will then create and lock a matching .ncb file for it (useful if there is no .ncb file around just yet).
Please let me know, if you think I am approaching all this in a bit too gung-ho a fashion.
Cheers,
Joerg