Replies: 4 comments
-
|
The problem is likely the way the arguments are being quoted before they are passed to msdeploy. msdeploy.exe is receiving the source argument as: "-source:contentPath="D:\a\WSSW\WSSW\deploy"" Because the argument starts with a double quote instead of -, MSDeploy reports: All arguments must begin with "-" When using a PowerShell argument array, you usually do not need to wrap the whole argument in escaped quotes. Try building the arguments like this: $sourcePath = Join-Path $PWD "deploy" $msdeployArgs = @( & $env:MSDEPLOY_PATH @msdeployArgs Also, in your snippet you define $destSite, but the deploy argument uses $destPath. Make sure the variable names match, otherwise the destination path may be empty. |
Beta Was this translation helpful? Give feedback.
-
|
The error is caused by the argument being passed with extra quotes. Try removing the escaped quotes around the $msdeployArgs = @(
"-verb:sync"
"-source:contentPath=$sourcePath"
"-dest:contentPath=$destPath,computerName=$computerName,username=$env:DEPLOY_USER,password=$env:DEPLOY_PASS,authType=Basic"
"-allowUntrusted"
"-enableRule:AppOffline"
"-verbose"
) |
Beta Was this translation helpful? Give feedback.
-
|
When PowerShell sees escaped double quotes (like Instead of MSDeploy receiving this: PowerShell forces it to receive this: MSDeploy's custom parser looks at the very first character, sees a " instead of a -, and immediately throws the exact error you are seeing. The Bonus Bug: Copilot's Typo The Solution Here is your refactored GitHub Workflow snippet: PowerShell 1. Build the arguments as a single string.2. Notice that $destPath has been corrected to $destSite here!$msdeployArgs = "-verb:sync -source:contentPath= 3. Execute via cmd.exe to prevent PowerShell from wrapping the whole string in quotescmd.exe /c " 4. Catch any errors so your GitHub Action properly fails if the deployment failsif ($LASTEXITCODE -ne 0) { |
Beta Was this translation helpful? Give feedback.
-
|
The issue is the extra quoting around the MSDeploy is receiving something like this: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
🏷️ Discussion Type
Question
💬 Feature/Topic Area
Workflow Deployment
Discussion Details
My GitHub Workflow is raising an error when it tries to deploy to a Windows Server for my hosting company. Here is a code snippet of what's involved:
The error that is raised is:
The definition I am using for
sourceis what GitHub Copilot suggested. Anyway, I don't see what's wrong and the "-" looks to me like it is correct. So, what is wrong?Beta Was this translation helpful? Give feedback.
All reactions