问题
In my Visual Studio 2010 SP1Rel, MS web deploy has suddenly stopped workingwith this error:
Unrecognized argument 'Web'. All arguments must begin with "-".
The argument "Web" refers to the parameter "Default Web Site", ie web deploy cannot deploy if the path contains spaces. This worked until today.
If I rename my website to DefaultWebSite (no spaces) then the error message changes to:
Unrecognized argument 'Source=10.10.10.1\MSSQLSERVER,1432;Initial'.
All arguments must begin with "-".
There are other questions about the same error but the circumstances are different. I am using the built in web deploy dialog.
Same error, but for a batch script: MSDeploy batch file does not handle quotes anymore Same error, but in powershell: How do you call msdeploy from powershell when the parameters have spaces?
These questions are related to installing VS 2010 SP1. I did not install SP1. It might have been automatically installed in a windows update.
How do I solve this error when using the MS deploy dialog (right click the project in VS and click Deploy)?
回答1:
This was a bug in the way the UseMSDeployExe flag works; it's generating an invalid set of command line parameters for WebDeploy. Try removing that line from your wpp.targets file, and it should work correctly. This bug will be fixed in a future release.
Side note: UseMSDeployExe is mainly intended as a test hook for the VS team to debug issues with WebDeploy. VS has 2 separate modes: In-proc usage of WebDeploy (via reflection I think), and Out-of-proc by shelling out to msdeploy.exe (hence the UseMSDeployExe flag). There's no real benefit to setting UseMSDeployExe, unless you're looking for the command arguments VS is passing to WebDeploy.
来源:https://stackoverflow.com/questions/8833978/ms-deploy-from-deploy-dialog-not-powershell-does-not-work-if-there-are-quotes