1

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

  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.

Community
  • 1
  • 1
Kjensen
  • 12,447
  • 36
  • 109
  • 171

1 Answers1

1

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.

Daniel Mann
  • 57,011
  • 13
  • 100
  • 120
  • Thanks! That clears up why it does not work as I thought... However, Windows Machine file copy requires username, password etc. Since I am deploying to an Azure Web Site, I don't think I have those. I guess my solution should be to get the email templates into the MyWebJob zip-file during build in stead. – Kjensen Oct 25 '17 at 15:52
  • Then copying a file to an arbitrary place on your agent machine certainly won't get it into Azure. – Daniel Mann Oct 25 '17 at 15:53
  • just edited my comment while you wrote another... :) – Kjensen Oct 25 '17 at 15:54