Teamcity deploy command line - iis

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.

Related

AWS Elastic beanstalk - My deployed app can't seem to write pdf's into this directory i've set up in my project folder

I am currently using nodejs that is deployed in ebs on aws. I have a function that will write a pdf and then email it off but it says the file path can't be found. I've verified the project file seems to be /var/app/current/, but changing the reference of the file path doesn't seem to remove the error. Any idea how to go about fixing this?
The /var/app/current/ does not exist initially. Its only created at the very last stage of your deployment.
The deployment happens in /var/app/staging/ folder, and at the very last, once everything finishes, /var/app/staging/ is moved into /var/app/current/.
Thus, I would not recommend using absolute paths in your project or config files. Its better to use relative path or container_commands for config scripts:
The specified commands run as the root user, and are processed in alphabetical order by name. Container commands are run from the staging directory, where your source code is extracted prior to being deployed to the application server.

How to copy files to wwwroot directory using copy "Copy Files To azure" pipeline?

I am using azure devops to host my angular application on azure appservice and it's working great. I have two files in my src folder of project and I want to move or paste those files into the wwwroot directory where my application's published code is placed.
If I add dist in the Target Folder of "Copy Files To" then files copying to the dist folder as you can see in the second image. But If i place wwwroot then after completion of this pipeline the message shows that Copying "D:\a\1\s\src\server.js to wwwroot\server.js" but if i see the directory then these files are not showing any where. I have tried $(Build.ArtifactStagingDirectory) in the Target Folder also but it's not working though. How can i copy the files from src to wwwroot?
1.You should make sure the target folder and the folder to publish is the same folder.
For example: If you copy those two files directly into $(Build.ArtifactStagingDirectory), then your Publish Artifact Task's Path To Publish should also be $(Build.ArtifactStagingDirectory).
2.Then in your Azure App Service Deploy task(if this task is in release pipeline), you should make sure the path is correct to find the drop folder:
(Use the button to find the artifact path, and add /drop)
3.Finally in Azure Web Portal, navigate to App Service=>Configurations=>Virtual path and make sure the physical path is wwwroot instead of wwwroot\dist:
Then it works well on my side to deploy the files in wwwroot folder.

Visual Studio Online Build and Release - Copy files to another project

In a solution, I have three projects (for the sake of this example):
- MyWebJob
- MyFrontendWebsite
- MyBackendWebsite
/Views/EmailTemplates/SomeEmailTemplate.cshtml (file in MyBackendWebsite)
When deployed, MyWebJob runs as we webjob below MyFrontendWebsite.
However, it needs the email templates from the MyBackendWebsite Emailtemplates folder.
I think the solution could be...:
Publish the EmailTemplates as an artifact.
During release, copy that artifact to the webjob folder, using a "Copy Files" task.
The problem is, I don't know what to enter in the Target Folder.
Using KUDU, I know that the webjob is stored in
D:\home\site\wwwroot\app_data\jobs\continuous\MyWebJob, but setting that as the target folder does not copy anything, despite the release log file telling me it did copy the file to that folder...
2017-10-25T15:09:11.7357129Z ##[section]Starting: Copy Files to: D:\home\site\wwwroot\app_data\jobs\continuous\MyWebJob
2017-10-25T15:09:11.7591720Z ==============================================================================
2017-10-25T15:09:11.7591720Z Task : Copy Files
2017-10-25T15:09:11.7591720Z Description : Copy files from source folder to target folder using match patterns (The match patterns will only match file paths, not folder paths)
2017-10-25T15:09:11.7591720Z Version : 2.117.0
2017-10-25T15:09:11.7591720Z Author : Microsoft Corporation
2017-10-25T15:09:11.7591720Z Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=708389)
2017-10-25T15:09:11.7591720Z ==============================================================================
2017-10-25T15:09:14.3013048Z found 1 files
2017-10-25T15:09:14.3013048Z Copying d:\a\r1\a\MyBuildDefinition\EmailTemplates\SomeEmailTemplate.cshtml to D:\home\site\wwwroot\app_data\jobs\continuous\MyWebJob\EmailTemplates\SomeEmailTemplate.cshtml
2017-10-25T15:09:14.3043047Z ##[section]Finishing: Copy Files to: D:\home\site\wwwroot\app_data\jobs\continuous\MyWebJob\EmailTemplates
2017-10-25T15:09:14.3093036Z ##[section]Finishing: Release
What am I missing here? How do I copy that email template to where the webjob can get to it?
Pre-empting what I myself would have asked...:
Q: Why not just put the templates in the webjob project in the first place?
A: Because the template is actually used in the MyBackendWebsite as well, to preview emails.
You're copying files to the folder D:\home\site\wwwroot\app_data\jobs\continuous\MyWebJob\EmailTemplates on your release agent.
You need to use the Windows Machine File Copy task to copy the files to the appropriate server.

MSDeploy - sync command to copy files to subfolder of iis app

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.

Setting up a workspace using Team Explorer Everywhere on Linux

Im having trouble creating a workspace and downloading the files from a Team Foundation Server using the Team Explorer Everywhere command line client (TEE-CLC-10.0.0). I've gotten as far as creating workspace:
$ ../tfs/TEE-CLC-10.0.0/tf -login:secretUsername,secretPassword -server:http://secretHost:8080 workspace -new KOLOBI
Workspace 'KOLOBI2' created.
Then I want to download files from the server to my workspace:
$ ../tfs/TEE-CLC-10.0.0/tf -login:secretUsername,secretPassword -server:http://secretHost:8080 get -recursive -all -force .
An argument error occurred: Items must reside in a workspace that has been previously used on this computer.
I guess I'm missing one step which is to add local directories to the workspace or something like that. But I can't figure out how to do it to be able to download the files.
You'll need to create working folder mappings between your local folder and the server items you wish to correspond to.
For example:
tf workfold -map -login:secretUsername,secretPassword -server:http://secretHost:8080 -workspace:KOLOBI '$/TeamProject/Project' '/home/me/project'
Then from the /home/me/project directory (or whatever you pick), you can just execute tf get .

Resources