Visual Studio 在线构建和发布 - 将文件复制到另一个项目

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

在一个解决方案中,我有三个项目(为了这个例子):

- MyWebJob

- MyFrontendWebsite

- 我的后端网站

部署后,MyWebJob 运行在我们下面的 webjob MyFrontendWebsite.

但是,它需要 MyBackendWebsite Emailtemplates 文件夹中的电子邮件模板。


我认为解决方案可能是...:[=​​14=]

  1. 将 EmailTemplates 发布为工件。

  1. 在发布期间,使用“复制文件”任务将该项目复制到 webjob 文件夹。

问题是,我不知道要在目标文件夹中输入什么。

使用KUDU,我知道webjob存储在
D:\home\site\wwwroot\app_data\jobs\continuous\MyWebJob,但将其设置为目标文件夹不会复制任何内容,尽管发布日志文件告诉我它确实将文件复制到该文件夹​​...

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

我在这里错过了什么?如何将该电子邮件模板复制到 webjob 可以访问的位置?

抢占我自己会问的...:[=​​14=]

问:为什么不直接将模板放在 webjob 项目中?

A:因为模板实际上也用在MyBackendWebsite中,预览邮件。

您正在将文件复制到发布代理上的D:\home\site\wwwroot\app_data\jobs\continuous\MyWebJob\EmailTemplates文件夹中。

您需要使用 Windows 机器文件复制 任务将文件复制到适当的服务器。