There is an error with the way Microsoft’s Web Deploy 2.1 application creates command line packages from Visual Studio 2010.
If you create a package to publish and then try to run the msdeploy.exe command line publishing tool it on a production server running IIS then you may receive the following error:
ERROR: The system was unable to find the specified registry key or value. msdeploy.exe is not found on this machine. Please install Web Deploy before execute the script.
Assuming that you actually have installed Web Deploy from http://www.iis.net/download/WebDeploy then the error may be caused by an incorrect registry path variable in the .cmd file that Visual Studio creates.
Open up the <application>.deploy.cmd file that is part of your deployment package in a text editor and look for the following code block:
if "%MSDeployPath%" == "" ( for /F "usebackq tokens=2*" %%i in (`reg query "HKLM\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\1" /v InstallPath`) do (if "%%~dpj" == "%%j" ( set MSDeployPath=%%j
If you have installed Web Deploy 2.0 or higher, then the error is caused by the registry query toHKLM\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\1. If you open up regedit on your production server you’ll find that the appropriate key is actuallyHKLM\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\2.
Change the reference in the<application>.deploy.cmd file and you’ll be able to successfully run the deployment package.
Now does anyone know how to stop this occurring?