I've developed a WCF web service that contains a dependency on an unmanaged DLL. When I attempt to publish the Web application to a running server (either local or remote) via Visual Studio 2010's One-Click Web Deploy, the deletion of the existing bin folder fails because that unmanaged DLL is still loaded in memory by IIS, causing the publish operation to fail leaving the web application folder empty except for the undeleted DLL. If I then manually recycle IIS' application pool on the server or restart IIS, I am able to successfully perform the publish operation.
Is there any way to automate the app pool recycle at the very start of Visual Studio's publish operation somehow? The server name and web application name varies according to different Web Deploy profiles, just to keep things interesting.
Alternative suggestions are also welcome.
Some related links I came across so far:
How to: Deploy a Web Application Project Using One-Click Publish and Web Deploy
Is it neccassary to recycle the app pool when placing a WCF project to live?