Kjensen
Kjensen

Reputation: 12374

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

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...:

  1. Publish the EmailTemplates as an artifact.

enter image description here

  1. During release, copy that artifact to the webjob folder, using a "Copy Files" task.

enter image description here

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.

Upvotes: 1

Views: 247

Answers (1)

Daniel Mann
Daniel Mann

Reputation: 59016

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.

Upvotes: 1

Related Questions