【问题标题】:Bitbucket Pipeline / .Net Core - Project file does not existBitbucket Pipeline / .Net Core - 项目文件不存在
【发布时间】:2020-07-08 08:44:31
【问题描述】:

.yml 文件:

image: microsoft/dotnet:sdk

pipelines:
  default:
    - step:
        caches:
          - dotnetcore
        script: # Modify the comma`nds below to build your repository.
          - export SOLUTION_NAME=SSU.IS.Services
          - export PROJECT_NAME=SSU.IS.Identity
          - export TEST_NAME=SSU.IS.Module.StaffRecords.Test
          - dotnet restore $SOLUTION_NAME
          - dotnet build $PROJECT_NAME
          - dotnet test #$TEST_NAME

bitbucket-pipeline.yml 位于根目录中,有一个名为 SSU.IS.Services 的文件夹,其中包含 .sln 以及其他包含项目的文件夹。

还原没有问题,但是构建步骤出错。

我尝试将其留空,指定项目名称,给出我认为是项目的相对路径 - 一切都无济于事。

.csproj 的路径

identity-management-mvc/SSU.IS.Services/Sites/Identity/SSU.IS.Identity/SSU.IS.Identity.csproj

【问题讨论】:

    标签: .net-core continuous-integration bitbucket bitbucket-pipelines


    【解决方案1】:

    对于那些阅读输入完整路径(包括文件扩展名)的人来说:

    image: microsoft/dotnet:sdk
    
    pipelines:
      default:
        - step:
            caches:
              - dotnetcore
            script: # Modify the comma`nds below to build your repository.
              - export SOLUTION_NAME=SSU.IS.Services
              - export PROJECT_NAME=SSU.IS.Services/Sites/Identity/SSU.IS.Identity/SSU.IS.Identity.csproj
              - export TEST_NAME=SSU.IS.Services/Tests/SSU.IS.Module.StaffRecords.Test/SSU.IS.Module.StaffRecords.Test.csproj
              - dotnet restore $SOLUTION_NAME
              - dotnet build $PROJECT_NAME
              - dotnet test $TEST_NAME
    

    【讨论】:

      【解决方案2】:
      /opt/atlassian/pipelines/agent/build/"ProjectSolutionName"/"ProjectName".csproj
      

      只有这对我有帮助。享受 =)

      【讨论】:

      • 你为 PROJECT_NAME 存储这个?
      • 不,我没有在任何地方保存项目名称,我只知道项目名称
      • 对,但您是否在“export PROJECT_NAME=" 中使用该路径
      猜你喜欢
      • 2017-03-31
      • 2020-04-13
      • 1970-01-01
      • 2021-07-21
      • 1970-01-01
      • 2021-07-11
      • 1970-01-01
      • 2016-09-28
      • 1970-01-01
      相关资源
      最近更新 更多