gpt4 book ai didi

msbuild - 如何在 Bitbucket Pipelines 中构建子文件夹

转载 作者:行者123 更新时间:2023-12-05 00:15:07 25 4
gpt4 key购买 nike

我正在努力在 Bitbucket Pipelines 中配置构建。
这是一个 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

最佳答案

通过实验发现它,文档根本没有提到它。

您需要在两行中使用完整路径和解决方案文件名,并且仅使用 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

关于msbuild - 如何在 Bitbucket Pipelines 中构建子文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45428729/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com