Phew... I finally figured it out! It was a tough one. Here is how I fixed
and the cause.
Yesterday, I was evaluating Vault Server on my machine. During the
installation of Vault, there was a step where it wanted me to set certain
security for the folder C:\Documents and Settings\All Users\Application
Data\Microsoft\Crypto\RSA or somewhere around there. I don't remember
exactly which folder. I may have screwed setting the security to the folder,
and delay signing stopped working.
This morning, because of my strong desire that I didn't want to reinstall my
OS, I spent some time to do figure it out. I created a new project and tried
the delay signing. It failed. Then I was sure that there was something wrong
with my machine, not the project itself as I mentioned in the comment.
So just to make sure I could sign an Assembly, I tried to generate a key
file. Even that failed with the message of Access denied. I wondered access
is denied to which folder?? I thought sn.exe must be trying access some
folder I don't know at all. So I used Sysinternals' File Monitor tool which
is available for free. There I saw some items that say "Access is denied".
The folder to which the access was denied was the folder I mentioned above.
Then my light blub lit! Ahhhhh, I set security to the folder yesterday when
I was installing Vault! So I set the security to the folder back to what it
was, and key generation worked. And then I went back to VS .NET tried to
compile the solution. It worked!
I was going to reinstall my OS if I couldn't figure it out, but Sysinternals
saved my life again. I hope this blog will be helpful for those who have the
same kind of problem!