【问题标题】:Azure build pipeline not generating bin folderAzure 构建管道不生成 bin 文件夹
【发布时间】:2020-05-26 18:37:04
【问题描述】:

我有包含多个项目的 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

【问题讨论】:

    标签: c# asp.net-mvc visual-studio asp.net-mvc-5 azure-devops


    【解决方案1】:

    这种行为的可能原因是什么?

    根据您提供的图像,如果我在 Visual Studio 构建任务中选择 project file .csproj 而不是 solution file .sln,我可以重现此问题:

    那是因为如果我们选择项目文件.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文件夹没有生成。

    为了解决这个问题,我们在 Visual Studio Build 任务中选择解决方案文件:

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

    更新:

    当我选择解决方案而不是 csproj 时,我得到了相关的错误 由于缺少一些引用而导致构建不成功。

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

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

    希望这会有所帮助。

    【讨论】:

    • 当我选择解决方案而不是 csproj 时,由于缺少一些参考,我得到了与不成功构建相关的错误。所以我通过指向 csproj 解决了这个问题,请不要这样:所有文件都在当前情况下成功生成,但只有 bin 文件夹不是。感谢您的支持。
    • @MohammadYusuf,请分享您的 Visual Studio 构建任务并在您的问题中发布工件任务日志,以便我们检查此问题的原因。
    • 已更新,请查看更新后的图片,我选择了解决方案而不是csproj
    • @MohammadYusuf,我已经更新了解决方案的答案,检查是否有帮助。
    • 非常感谢您的支持,谢谢!但现在我又遇到了另一个错误。我有用于文档查看器的 nuget 包 gleamteach,它说要恢复它们,但在 nuget 上找不到它们。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-10-28
    • 1970-01-01
    • 2014-11-26
    • 2020-01-11
    • 1970-01-01
    • 2019-08-24
    • 1970-01-01
    相关资源
    最近更新 更多