2017-08-01 116 views
2

我很努力在Bitbucket流水线中配置构建。如何在Bitbucket流水线中构建子文件夹

这是一个C#解决方案,代码位于子文件夹中,而不是位于存储库的根文件夹中。这就是为什么当我建立它,我得到的错误:

+ dotnet restore

MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.

我读过的文档,但似乎没有选项来尝试指定一个子文件夹。那么你如何配置它?

这是我的.yml文件:

image: microsoft/dotnet:latest 

pipelines: 
    default: 
    - step: 
     caches: 
      - dotnetcore 
     script: # Modify the commands below to build your repository. 
      - export PROJECT_NAME=MyProjectNameHere 
      - export TEST_NAME=MyProjectNameHere 
      - dotnet restore 
      - dotnet build $PROJECT_NAME 
      - dotnet test $TEST_NAME 

回答

2

通过实验发现,该文档并没有提到它。

您需要使用的restore行两行完整路径和文件名的解决方案,只有文件夹名称:

image: microsoft/dotnet:latest 

pipelines: 
    default: 
    - step: 
     caches: 
      - dotnetcore 
     script: # Modify the commands below to build your repository. 
      - export PROJECT_NAME=FolderNameHere/MySolution.sln # use the full path and solution file name 
      - export TEST_NAME=FolderNameHere/MySolution.sln # use the full path and solution file name 
      - dotnet restore FolderNameHere # use only folder name here 
      - dotnet build $PROJECT_NAME 
      - dotnet test $TEST_NAME 
+0

为我工作!谢谢 –

相关问题