Testing/Debugging Shell Extension & Regasm & explorer.exe
I successfully created a shell extension (A context menu handler to be exact) in C# using .NET 4.0. I used Regasm to register the extension, and again Regasm to unregister the extension. The whole process works wonderfully.
I am having one problem though: explorer.exe won't let go of my DLL after testing. I can't delete it, and I can't do another build without VS complaining. The only thing I've been able to do to release the DLL is restart explorer.exe. So that's my question: How do I test as I go along without going through that whole process each time?
I'd also appreciate any tips on speeding up the testing/debugging process.
Edit: I found the Register for COM Interop option in my project properties. It does speed up the debugging process, but I'm still left with the explorer.exe issue.
Edit 2: I did end creating a batch file to kill and then restart explorer.exe, and used that in my pre-build event. However even though I used to "start" command to run the tasks in the background, Visual Studio would freeze indefinitely during the build process. I ended up using this tool http://www.commandline.co.uk/cmdow/ to comple开发者_运维知识库tely run the commands in the background.
I did end creating a batch file to kill and then restart explorer.exe, and used that in my pre-build event. However even though I used to "start" command to run the tasks in the background, Visual Studio would freeze indefinitely during the build process. I ended up using this tool http://www.commandline.co.uk/cmdow/ to completely run the commands in the background.
I have another suggestion: You could use Unlocker to unlock the DLL. After that, you should be able to compile again. According to the website, Unlocker even features a command line tool, so you could integrate it into your build process.
精彩评论