Last september, I posted a message about abnormal compilation times in
Visual Studio .NET.
I got some help from a nice guy from Sweden, who had the same problem and
saw my post on the newsgroup. With his help, I ended up opening a support
incident to MS and we got our issue resolved.
So, I'm posting the workaround that MS gave us because it might interest
people who have a setup like ours and who may be experiencing the same kind
of problem.
The problem occurs if:
* You run Visual Studio (2002 or 2003) on a PC running Windows XP Pro
* Your solution contains "signed" assemblies (using the AssemblyKeyFile
attribute in your AssembyInfo file)
* Your PC is connected to a domain controller running NT 4 (you won't get
the problem if you are connected to a Win2K or Server 2003 domain
controller).
If you have this setup, you are likely to get abnormal compilation times,
but, if you disconnect your PC from the network (or disable the network card
through the control panel), the problem will go away and you will get much
faster compiles. The effect is sometimes dramatic, for example, we had a
simple WinForms solution with 5 signed assemblies that took 50 seconds to
compile with the network cable on, and only 3 seconds without it (if you
feel that VS is slow and you suspect that you are being hit by this problem,
you should try this simple test).
Of course, disabling the network card before every compile can really get
painful, which is how we worked for about 2 months, but we finally got the
issue resolved today. The solution consists in defining a special registry
value (MasterKeyLegacyNt4Domain) somewhere in the depths of the registry
database, as described by the following link
http://support.microsoft.com/?id=331333
Then, you just reboot your PC and you get normal compilation speed (even
when your PC is connected to the domain controller).
Note: The MS note mentions some security issues related to this registry
change. So, you should also read it carefully before applying this patch.
Don't ask me why this registry key solves the problem (the MS note does not
really explain it), or why the problem was there in the first place, this is
way beyond my understanding of Windows. To me, this is just magic but I
thought that some of you may be interested by this trick.
Bruno.