VSTS Publish Artifact为空,MVC Web应用程序在本地部署 [英] VSTS Publish Artifact empty, MVC web app deploy on-prem

查看:37
本文介绍了VSTS Publish Artifact为空,MVC Web应用程序在本地部署的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用托管的构建代理和本地发布代理.
Project是与其他项目一起提供的解决方案中的ASP.Net MVC Web应用程序.构建成功完成,但是工件文件夹中没有任何内容,因此该发行版不执行任何操作.

[更新5/22/2018]我需要做的是发布到与托管代理相关的某个位置,然后在本地发布代理中,能够使用copy_files任务将这些文件简单地复制到unc路径.

[更新5/23/2018]
在构建任务上使用这些msbuild参数,我能够获得一个包含已发布文件的压缩文件夹.现在唯一的问题是文件处于深度嵌套的结构中.因此,我只需要在发布任务上解压缩它们,或者防止它们被压缩即可.

 /t:My_MVCWeb_Project_Name/p:DeployOnBuild = true/p:WebPublishMethod = FileSystem/p:PackageAsSingleFile = true/p:SkipInvalidConfigurations = true/p:PackageLocation ="$(build.artifactstagingdirectory)\\" 

构建日志

构建任务(托管VS 2017代理)./t参数后跟一个project_name.

发布构建定义的任务

发布定义,仅带有copyfiles任务(此任务在本地运行)

解决方案

由于使用 ASP,因此需要在 Build 步骤中使用默认的 MSBuild参数.NET构建模板:

 /p:DeployOnBuild = true/p:WebPublishMethod = Package/p:PackageAsSingleFile = true/p:SkipInvalidConfigurations = true/p:PackageLocation ="$(build.artifactstagingdirectory)\\" 

或者您需要添加

Trying to use a hosted build agent and an on-prem release agent.
Project is an ASP.Net MVC web app within a solution with other projects. The build completes successful but there is nothing in the artifact folder so the release does nothing.

[ update 5/22/2018] What I need to do is publish to some location relevant to the hosted agent, then in my on-prem release agent, be able to use a copy_files task to simply copy those files to a unc path.

[ update 5/23/2018]
Using these msbuild arguments on the build task, I was able to get a zipped folder containing the published files. The only problem now is that the files are in a deeply nested structure. So I either just need to unzip them on a release task, or prevent them from being zipped.

/t:My_MVCWeb_Project_Name /p:DeployOnBuild=true /p:WebPublishMethod=FileSystem /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\\"

Build log

Build task (Hosted VS 2017 agent). The /t parameter is followed by a project_name.

Publish task of Build definition

Release definition, with just a copyfiles task (this runs on-prem)

解决方案

You need to use the default MSBuild Arguments in Build step since you use ASP.NET build template:

/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\\"

Or you need to add a Copy Files task before Publish Build Artifacts to copy the files you need to path $(build.artifactstagingdirectory):

这篇关于VSTS Publish Artifact为空,MVC Web应用程序在本地部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆