10

I'm trying to execute a web deploy script on a clean build Windows Server 2008 R2 machine and getting 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.

The package was created in VS2010 and executes fine on my development box (as always!). If I import the package on the server through IIS everything works fine.

Web Deploy has been installed on the server through the Web Deployment Tool 2.1 via the Web P.I and I've verified the inclusion of msdeploy.exe. I'm running the script through the "IIS Extensions/Web Deploy Command Line" start menu item so I'm guessing that the correct paths should be set. I've also tried it as Administrator with the same error.

Any help greatly appreciated.

Darren Lewis
  • 8,338
  • 3
  • 35
  • 55
  • I have the same problem. Installed WebDeploy_2_10_amd64_en-US. Running the Deploy Command Line I get the same erorr – halcwb May 20 '11 at 10:47
  • Also, see this question: http://stackoverflow.com/questions/6595086/msdeploy-v2-doesnt-work-with-vs2010s-packages – David Hogue Jan 11 '12 at 18:40
  • I was stuck with this error message on self hosted agent in Azure DevOps for several hours until I have discovered that pipeline was picking wrong agent (the one that had no msbuild installed) from the pool... – Yehor Androsov Mar 22 '21 at 18:32

2 Answers2

10

Copied from here:

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 .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 to HKLM\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\1. If you open up regedit on your production server you’ll find that the appropriate key is actually HKLM\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\2.

Change the reference in the.deploy.cmd file and you’ll be able to successfully run the deployment package.

Yehor Androsov
  • 4,885
  • 2
  • 23
  • 40
Brian Maddox
  • 101
  • 3
  • 2
    This issue has been resolved in Visual Studio SP1. Upgrading will resolve this issue. – Sam Plus Plus Aug 29 '11 at 13:24
  • 1
    @Sam, Daz: It supposedly is fixed in SP1, but I have SP1 installed, and it is still occurring for me. Tho I installed the web deploy package from IIS.Net, not knowing it was already on my box, so I'm not sure if it will be fixed for other people or not... The file that is buggy is `Microsoft.Web.Publishing.targets` – Merlyn Morgan-Graham Oct 06 '11 at 01:18
  • 1
    Link in answer is dead - *"This site can’t be reached / blog.evonet.com.au’s server DNS address could not be found"* – Pang Jun 13 '17 at 01:17
0

I have the same problem. Installed WebDeploy_2_10_amd64_en-US. Running the Deploy Command Line I get the same erorr. However, in IIS (version 7) I could use an option import application. With this option (right side of the window in the actions toolbar) I was able to import the application deployment package zip file. All settings were imported correctly except for the application pool. I only had to adjust that and everything was running fine.

halcwb
  • 1,480
  • 1
  • 13
  • 26