[英]Azure pipelines - dotnet publish overwriting VSBuild .zip's then complaining it can't find them
My.sln consists of several projects (.cspoj) with a mix of targeting frameworks including .netcore and a selection of .net frameworks. My.sln 由多个项目 (.cspoj) 组成,其中包含多种目标框架,包括 .netcore 和一系列 .net 框架。
Some of these projects are web projects which need to be built and include other non-web projects in their packages.其中一些项目是 web 项目,需要构建并在其包中包含其他非 Web 项目。
This is essentially a teamcity to azure devops migration - I figured using vsbuild and then dotnetcorecli 'publish' would give me the required packages (publish command does find the correct webapps).这本质上是 azure devops 迁移的团队城市 - 我认为使用 vsbuild 然后 dotnetcorecli 'publish' 会给我所需的包(publish 命令确实找到了正确的 webapps)。
My issue is that after VSBuild I have oneproject.zip in my "artifact staging dir", the dotnet publish command afterwards, which is set to output into "artifact staging dir/publish", simply erases all content from "oneproject.zip" and then complains it cannot find "oneproject", please see the error output below the pipeline.我的问题是,在VSBuild之后,我的“工件暂存目录”中有oneproject.zip,之后的dotnet发布命令设置为output到“工件暂存目录/发布”,只需删除“oneproject.zip”中的所有内容并然后抱怨它找不到“oneproject”,请参阅管道下方的错误 output。
pool: selfhosted
using a self hosted agent, with msbuildtools/vs studio/node/npm使用自托管代理,带有 msbuildtools/vs studio/node/npm
variables:
solution: '**/mainsolution.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Debug'
global variables全局变量
stages:
- stage: build_main
displayName: 'Build Main'
jobs:
using stages, to prevent overwriting source files by grouping tasks使用阶段,通过分组任务来防止覆盖源文件
- job: multijob
steps:
- task: NuGetToolInstaller@1
displayName: 'install nuget'
- task: NuGetCommand@2
displayName: 'NuGet restore'
inputs:
command: 'restore'
restoreSolution: '$(solution)'
feedsToUse: 'select'
vstsFeed: 'myvstsfeed'
installing nuget, and restoring from an azure artifacts feed安装 nuget,并从 azure 工件源恢复
- task: DotNetCoreCLI@2
displayName: 'dotnet restore'
inputs:
command: 'restore'
projects: '**/mainsolution.sln'
feedsToUse: 'select'
vstsFeed: 'myvstsfeed'
VSBuild - Building the main.sln which references all.csproj's , and a separate MSBuild for another odd project.* VSBuild - 构建引用 all.csproj's 的 main.sln ,并为另一个奇怪的项目构建单独的 MSBuild。*
- task: VSBuild@1
displayName: 'Build Solution'
inputs:
solution: '$(solution)'
msbuildArgs: '
/p:DeployOnBuild=true
/p:WebPublishMethod=Package
/p:PackageAsSingleFile=true
/p:SkipInvalidConfigurations=true
/p:PackageLocation="$(Build.ArtifactStagingDirectory)"'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
- task: VSBuild@1
displayName: 'Build oddproject'
inputs:
solution: '**/oddproject/oddproject.csproj'
msbuildArgs: '
/p:DeployOnBuild=true
/p:WebPublishMethod=Package
/p:PackageAsSingleFile=true
/p:SkipInvalidConfigurations=true
/p:PackageLocation="$(Build.ArtifactStagingDirectory)"'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
This is the problem, my publish step这是问题,我的发布步骤
- task: DotNetCoreCLI@2
inputs:
command: 'publish'
publishWebProjects: true
arguments: '--configuration $(BuildConfiguration) -o published'
##[debug]Zip arguments: Source: published\oneproject, target: published\oneproject.zip ##[debug]Zip arguments:来源:published\oneproject,目标:published\oneproject.zip
##[error]Error: ENOENT: no such file or directory, open 'A:\agent_work\2\s\published\oneproject.zip' ##[错误]错误:ENOENT:没有这样的文件或目录,打开 'A:\agent_work\2\s\published\oneproject.zip'
I really appreciate any inputs or critique on this.我非常感谢对此的任何意见或批评。 Let me know if there's anything useful I can provide as well.让我知道我是否也可以提供任何有用的东西。 <3 <3
Looks like "oneproject.csproj" wasn't a solution that could be built with dotnetcorecli.看起来“oneproject.csproj”不是可以使用 dotnetcorecli 构建的解决方案。 After isolating the correct projects to separate into vsbuild and dotnetpublish - the build progressed.在隔离正确的项目以分离为 vsbuild 和 dotnetpublish 之后 - 构建进行了。 I then had node and gulp issues, but those were solved by installing an older version (or any version from a build machine able to build it, node/gulp -v).然后我遇到了 node 和 gulp 问题,但是通过安装旧版本(或能够构建它的构建机器的任何版本,node/gulp -v)解决了这些问题。
I solved the artifact path issue by manually archiving the output of every vsbuild webproject's 'packagetmp' folder into artifact staging.我通过手动将每个 vsbuild webproject 的“packagetmp”文件夹的 output 归档到工件暂存中来解决工件路径问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.