Solidworks 2010 sp 5.0 exits abnormally after adding my addin

Hi,

I have an addin built on VB.NET for SolidWroks 2010. When I close SolidWorks after adding my addin, Windows 7 shows an error as shown in the below image.

The same code works fine with windows Xp operating system. I compiled the code for x64 and used with windows 7. The application runs very fine,

but after closing solidworks, win 7 shows above message.

Also while building/compiling the application for first time it shows error

Error1File "C:\\Users\\Administrator\\Desktop\\SwVBAddin1\\bin\\x64\\Debug\\SwVBAddin1.dll" is not a valid assembly.SwVBAddin1

but when built/compiled second time, the build will be successful, and sometimes the below error

Error1Unable to copy file "obj\\x64\\Debug\\SwVBAddin1.dll" to "bin\\x64\\Debug\\SwVBAddin1.dll". The process cannot access the file 'bin\\x64\\Debug\\SwVBAddin1.dll' because it is being used by another process.SwVBAddin1
SolidworksApi macros