Azure 构建管道不生成 bin 文件夹

Azure build pipeline not generating bin folder

我有包含多个项目的 aspnet MVC 5 解决方案,我需要使用 azure CI 和 CD 发布主项目,因此我配置了 azure 构建管道(配置见附件)。但是当生成工件时,我注意到没有包含部署文件的 bin 文件夹。这种行为的可能原因是什么?

This is the generated artifact

This is Solution Configuration task

This is the publish path

This is publish artifact configuration task

This is link for the logs of the pipeline

This is The error when i chose the solution instead of csproj

This is after chaining to SLN or set AnyCPU

what could be the possible reasons for this behavior?

根据您提供的图像,如果我 select 项目文件 .csproj 而不是 解决方案文件 .sln,我可以重现这个问题 在 Visual Studio 构建任务中:

那是因为如果我们select工程文件.csproj,我们建工程的时候有警告:

Warning : The OutputPath property is not set for project 'ASP.NETMVC.csproj'.  Please check to make sure that you have specified a valid combination of Configuration and Platform for this project.  Configuration='release'  Platform='any cpu'.  You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Configuration or Platform that doesn't exist for this project.

虽然任务结果通过了,但是由于上面的警告,输出没有正确输出。

说明你构建成功,但是bin文件夹没有生成

为了解决这个问题,我们 select Visual Studio 构建任务中的解决方案文件:

然后警告消失,生成bin文件夹:

更新:

when i select the solution instead of the csproj i got errors related to the unsuccessful builds due to some missing references.

那是因为您只是在 nuget 恢复任务中恢复了 packages.config 文件之一。您需要将其更改为 .sln 文件而不是 packages.config 文件。

此外,要解决您之前的问题,我们可以选择 .sln 文件而不是项目文件(我之前回答过。)。或者您可以将默认变量 BuildPlatformany cpu 更改为 AnyCPU(移动 space)。

希望这对您有所帮助。