AzureDevOps dotnet build项目路径的语法是什么?如何为dotnet build项目路径添加多个项目?

时间:2019-06-14 06:07:42

标签: azure-devops

作为标题,我们在**/*.csproj项目路径中通常使用dotnet build,效果很好。 但是我们最近添加了一个dotnet框架项目,尽管我们在* nix构建代理上运行我们的构建,但我们想排除该dotnet框架项目或仅包括dotnet核心项目,但是当我尝试更新诸如dotnet pack之类的项目路径时,我遇到以下错误:

Project file(s) matching the specified pattern were not found.

但是我定义的项目路径适用于dotnet pack项目路径,我很困惑。希望有人能帮忙。

我使用的项目路径:

Business/*.csproj;Models/*.csproj;
**/*.csproj;-FxModels/*.csproj;

来自https://github.com/MicrosoftDocs/vsts-docs/issues/3981的问题

1 个答案:

答案 0 :(得分:1)

  

AzureDevOps dotnet build项目路径的语法是什么?

AzureDevOps dotnet build项目路径没有特殊的语法,它仅使用相对路径通配符

当我们使用任务dotnet build来构建项目时,我们总是使用语法**/*.csproj将所有项目包括在存储库的指定分支中。当然,我们也可以使用完整路径来指定一个项目。例如:

在管道的获取源任务中,我们设置reposbranch

enter image description here

然后,转到repos以获取.net core项目的相对路径:

enter image description here

因此,如果只想构建.net核心项目,则.net core项目的相对路径为/NetCoreLibDemo/NetCoreLibDemo/NetCoreLibDemo.csproj

enter image description here

  

如何为dotnet build项目路径添加多个项目?

您可以使用dotnet build**/*.csproj项目路径指定多个项目,也可以指定.sln文件。

但是,我已经指出,如果您对多个项目使用任务 dotnet pack (而不是dotnet build),则可以创建一个模式以 -: 开头的否定形式,例如:

enter image description here

它在我这边工作正常,您可以检查它是否适合您。

更新

  

如上所述,dotnet pack项目grammer不适用于   dotnet构建,所以想要一个dotnet构建语法,这就是   问题

dotnet包指定了语法 -: 。您可以从选项的状态中获取它:

enter image description here

enter image description here

所以,就像我上面指出的那样,如果您想使用dotnet build**/*.csproj项目路径指定多个项目,或者指定.sln文件。

希望这会有所帮助。

相关问题