I researched quite a lot on this but finally seemed to pin down on this issue. Visual Studio some times randomly locks the build dll/exe file if you have custom controls in your project. Steps to replicate:
- Create a winforms app/dll project
- Add a new class, say CustomButton that inherits from Button
- Build
- Create a form. Look in the toolbox, and the custombutton appears allowing you drag it on your form
- [This now becomes random] the next build of your project will either proceed or fail requiring you to restart visual studio.
Any ideas?