Thursday, November 24, 2011

Visual Studio : Web deploy - Files\IIS\Microsoft was unexpected at this time

Built a project using the standard VS 2010 SP1 - Right click on the project - Build Deployment Package.

Then tried to deploy it via:

xxx.deploy.cmd /T

The /T does a whatif - always a good idea to check first!

Then run the following when you are happy:

xxx.deploy.cmd /Y

Got the error - "Files\IIS\Microsoft was unexpected at this time". WTF?

First off when you set the environment variable as per the txt file:

set MSDeployPath="C:\Program Files\IIS\Microsoft Web Deploy V2\"

Do NOT put the quotes in and remove the end \ i.e.

set MSDeployPath=C:\Program Files\IIS\Microsoft Web Deploy V2

What the script does is search for this variable and if it's missing, it tries to find the path in the registry via this code:

if "%MSDeployPath%" == "" (

for /F "usebackq tokens=1,2,*" %%h in (`reg query "HKLM\SOFTWARE\Microsoft\IIS Extensions\MSDeploy" /s ^
findstr -i "InstallPath"`) do (

if /I "%%h" == "InstallPath" (

if /I "%%i" == "REG_SZ" (

if not "%%j" == "" (

if "%%~dpj" == "%%j" (

set MSDeployPath=%%j


I have Web Deploy V2 deployed and I don't have such a registry entry? It's this piece of script that produces the error. Just comment it out and all will be sweetness and light.


No comments: