【问题标题】:Azure Pipeline - One csproj is missing in the buildAzure Pipeline - 构建中缺少一个 csproj
【发布时间】:2021-12-18 12:55:29
【问题描述】:

我开发了一个新项目并将其添加到现有的解决方案中。当我将它发送到我的 Git 存储库时,管道不要压缩它,也不要将它添加到我要定位的放置文件夹中,所以在我的发布之后,我无法将它部署到 Azure,因为该文件不存在.

我正在管道中使用“Visual Studio Build”任务和此命令用于 MSBuild 参数:

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

有了这个,我没有任何构建错误。

对于“解决方案”框,我告诉它去获取 .sln,因为其中有几个必须部署的项目。然而,新项目在 .sln 中得到了很好的引用,但管道没有构建它。

感谢您的帮助

【问题讨论】:

    标签: c# azure-devops azure-pipelines azure-webjobs msbuild-task


    【解决方案1】:

    在这种情况下,请确保我们将以下参数设置为 false:

    /p:PackageAsSingleFile=false 
    

    以下是其中一个示例:

    - task: VSBuild
      displayName: ‘solution for build'
      inputs:
        solution: '$(Parameters.solution)'
        msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactstagingdirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"   /t:Sample_WebApi:Rebuild'
        platform: '$(BuildPlatform)'
        configuration: '$(BuildConfiguration)'
    

    为确保不会错过 csproj,请将目标设置为文件夹级别而不是 csproj 文件级别。

    请参阅MS Docs 之一以了解构建及其相关信息,并了解Visual Studio Build 任务的每个构建。

    【讨论】:

      猜你喜欢
      • 2019-08-20
      • 2016-05-10
      • 2020-06-13
      • 2020-06-29
      • 2017-06-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多