I am using msdeploy.exe for deploying my project to remote iis site using below command
msdeploy.exe -source:iisApp="D:\publish" -dest:iisApp="test-site",ComputerName="https://url:8172/msdeploy.axd?site=test-site",UserName="u",Password="p",IncludeAcls='False',AuthType='Basic' -verb:sync -enablerule:AppOffline -enableRule:DoNotDeleteRule -retryAttempts:20 -allowUntrusted='True'
But it is always uploading each an every file during deployment.
Is there any way so that i can upload only changed files using msdeploy.exe?
Solved using -useChecksum paremeter
Related
I've configured TeamCity for build and deploy IIS app.
Everything works fine. Here is my command line param:
-verb:sync -source:package="webapi-%dep.xxx.build.counter%.zip"
-dest:contentpath="C:\inetpub\wwwroot\test2.com\bin",computerName="www",userName="uuu",password="ccc",includeAcls="False"
-AllowUntrusted -verbose
So, artifacts zip file should extract files to C:\inetpub\wwwroot\test2.com\bin folder. In bin folder i have a lot of xml and config files (zip file dont include this files). In every deploy it delete bin folder and extract zip files.
How can I skip deleting? I just need publish with replace what i have in archive without deleting another files?
Thanks for help
add one more parameter:
-enableRule:DoNotDeleteRule
according to doc:
In a sync operation, blocks deletions of files on the destination computer that do not exist on the source computer. This rule applies to the contentPath, dirPath, and filePath providers. This rule is disabled by default.
I have a problem related to creating msdeploy package for deploying to azure web app.
I run msdeploy -verb:sync -source:contentPath="C:\inetpub\wwwroot\<SiteName>" -dest:package=test.zip And after investigating package i found that it contains a full hierarchy of folders eg: \Content\C_C\inetpub\wwwroot\<SiteName>\ and when i am trying to deploy this package to azure a have an exception because i don't have such permissions.
Question: how to remove path from content folder so my archive will looks like \Content\<SiteName>?
After a day of investigation i figure out how to do this:
$msDeployPackageCommand = "$MsDeployExePath
-source:iisApp=$PathToApplication
-dest:package=$ZipCreationPath
-verb:sync
-enableLink:contentLibExtension
-replace:match=$ReplacePathToApplication,replace=$replaceWith
-retryAttempts:2
-disablerule:BackupRule
-declareParam:name='PackageManagementService',kind='ProviderPath',scope='IisApp',match=$ReplacePathToApplication,defaultValue=$replaceWith";
This works fine.
I had Composer Site extension installed till now on azure php webapp.
I need custom deployment that can run grunt tasks also. So I created the .deployment and deploy.sh files in project root. But that deploy.sh is not being picked up.
.deployment file contents:
[config]
command = bash deploy.sh
Looking at the deployment logs, I find this
2017-05-04T06:21:03.9301086Z,Updating submodules.,8bc3029f-d77b-4c1e-860f-a3d439d7a354,0
2017-05-04T06:21:03.9926050Z,Preparing deployment for commit id 'e2b45fb52b'.,61c286b1-5c00-4c11-ae14-54e0711d6857,0
2017-05-04T06:21:04.2632947Z,Running custom deployment command...,e71c397e-bc63-4357-abc4-acd49bc2041d,0
2017-05-04T06:21:04.3101663Z,Running deployment command...,24db1c4f-8a51-463b-8c4a-ee040bc5dfd8,0
2017-05-04T06:21:04.3101663Z,Command: D:\home\SiteExtensions\ComposerExtension\Hooks\deploy.cmd,,0
2017-05-04T06:21:04.4039215Z,The system cannot find the path specified.,,1
2017-05-04T06:21:04.4195462Z,The system cannot find the path specified.\r\nD:\Program Files (x86)\SiteExtensions\Kudu\62.60430.2807\bin\Scripts\starter.cmd D:\home\SiteExtensions\ComposerExtension\Hooks\deploy.cmd,,2
Seems like somewhere the trigger for Composer site extension still remains which is being invoked during deployment.
How can I completely remove Composer site extension and use my custom deployment script deploy.sh? Thanks in advance.
Found the problem. After uninstalling Composer SiteExtension, this environment variable is still present APPSETTING_COMMAND = D:\home\SiteExtensions\ComposerExtension\Hooks\deploy.cmd. Deleted the environment variable using kudu console and then deployment succeeded.
After removing the Composer Extension the APPSETTING_COMMAND remains as an environment variable.
Use the Kudu PowerShell command Remove-Item Env:\APPSETTING_COMMAND to remove the variable online.
Alternatively, restarting the App Service via the overview tab will refresh the environment variables, though this could be a little invasive.
I have 2 Azure App Service Deploy steps in a Team Services build, they have the same Subscription details. The only difference is that they target different virtual applications - the one that fails contains an é character, could that be the cause? Here the step output:
2017-01-17T16:04:22.8323742Z 8570d8e4-b732-4c45-87c5-619fe9343427 exists true
2017-01-17T16:04:24.5778681Z Got connection details for Azure App Service:'foo'
2017-01-17T16:04:24.6088690Z Running command: "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:getParameters -source:package="C:\a\1\a\Foo.zip" > "C:\a\1\s\parameter.xml"
2017-01-17T16:04:25.4027522Z Running command: #echo off
2017-01-17T16:04:25.4027522Z "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:package="C:\a\1\a\Foo.zip" -dest:auto,ComputerName='https://foo.scm.azurewebsites.net:443/msdeploy.axd?site=foo',UserName='********',Password='********',AuthType='Basic' -setParam:name='IIS Web Application Name',value='foo/bar-é' -userAgent:VSTS_foo_build_154_744 2>error.txt
2017-01-17T16:04:25.4027522Z if %errorlevel% neq 0 exit /b %errorlevel%
2017-01-17T16:04:25.4067519Z [command]C:\Windows\system32\cmd.exe /C C:\a\1\s\msDeployCommand.bat
2017-01-17T16:04:25.4157662Z 'C:\Program' is not recognized as an internal or external command,
2017-01-17T16:04:25.4167533Z operable program or batch file.
2017-01-17T16:04:25.4207534Z ##[error]Failed to deploy App Service.
2017-01-17T16:04:29.2496923Z ##[error]Error: Error: C:\Windows\system32\cmd.exe failed with return code: 9009
2017-01-17T16:04:29.2576899Z ##[section]Finishing: Azure App Service Deploy: foo-dev-global
It's almost as if the Powershell command itself is broken, I'm guessing by the special character.
It maybe not the special character causes that issue. I try to deploy the virtual Application with the special characters é , following is my detail steps. Hope it is useful. We also can get moreinfo about WebDeploy error code please refer to document.
1.Create a new build definition for the project
2.Select build solution corresponding VS version.
Before config Azure App Service Deployment, we need to create a WebApp in the Azure portal and the edit the appsetting to add the
Virtual applications info
Config the Azure App Service Deployment with service name and Virtual application created in the step3
5.New Queue build for the build definition
Then we can check that it deployed successfully from deployment log or from kudu.
This is now working as expected, without me making any changes. Having informed MS of the issue, I can only conclude they've released a fix to the build task.
I want to perform a post-build step to copy some files into a website folder using MSDeploy.
Eventually I'll be doing this to a remote location (specifying computerName, userName switches etc.), but for now I'm running it locally:
"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe"
-AllowUntrusted -verb:sync
-source:dirPath="D:\files_to_copy"
-dest:iisApp="My Website Name"
This works, but it removes all contents of the website folder and replaces them with the contents of "D:\files_to_copy" (as you might expect!). So I was wondering how I use this simply copy to a subfolder within the site?
I've tried -dest:iisApp="My Website Name/my_subfolder" but this just creates a new IIS app called "my_subfolder" nested within the existing IIS app.
There are providers other than iisApp, maybe dirPath is the one you want for -dest aswell?:
dirPath: The dirPath provider synchronizes directory content.
filePath: The filePath provider synchronizes individual files.
iisApp: The iisApp provider synchronizes directory content to a folder and marks the folder as an application.
contentPath: The contentPath provider synchronizes Web site content.
Anders's answer above provides the correct information, but the full code I used to successfully carry this out is as follows:
"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe"
-AllowUntrusted -verb:sync
-source:contentPath="D:\files_to_copy"
-dest:contentPath="My Website Name\my_new_folder"
Adding a single file to the root of the site (for example robots.txt) can be done using the following:
"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe"
-AllowUntrusted -verb:sync
-source:contentPath="D:\my_folder\robots.txt"
-dest:contentPath="My Website Name\robots.txt"
Hopefully this is a useful example for others in the future.