“dotnet publish”(.net core)构建步骤不适用于具有多个项目的visual studio团队服务

时间:2021-04-21 03:36:23

We have a VS 2017 solution with one WCF-service project and one .net-core web-application targeting .net framework 4.5.2 and .net core 1.0 (1.0.0-preview2-003131).

我们有一个VS 2017解决方案,其中包含一个WCF服务项目和一个.net-core网络应用程序,目标是.net framework 4.5.2和.net core 1.0(1.0.0-preview2-003131)。

By some reason I cannot get the website published through "dotnet publish"-command in visual studio team services.

由于某种原因,我无法通过视觉工作室团队服务中的“dotnet publish”命令发布网站。

The problem shows up in build step "dotnet publish", project is specified to match only the web-projects solution-file (**/InventoryIndexWeb.csproj) since I only want the web to be published in this build.

问题出现在构建步骤“dotnet publish”中,指定项目仅匹配web-projects解决方案文件(** / InventoryIndexWeb.csproj),因为我只希望在此构建中发布Web。

Gives the following errors:

给出以下错误:

  • MSBUILD : error MSB1008: Only one project can be specified.

    MSBUILD:错误MSB1008:只能指定一个项目。

  • Dotnet command failed with non-zero exit code on the following projects : d:\a\3\s\WebSites\InventoryIndex\Staging\InventoryIndexWeb\InventoryIndexWeb.csproj

    Dotnet命令在以下项目中以非零退出代码失败:d:\ a \ 3 \ s \ WebSites \ InventoryIndex \ Staging \ InventoryIndexWeb \ InventoryIndexWeb.csproj

See screenshot for details:

详见截图:

“dotnet publish”(.net core)构建步骤不适用于具有多个项目的visual studio团队服务

Any suggestions how to solve this or workarounds? The plan is to push this to Octopus deploy as well when we get the publish step working.

有任何建议如何解决这个问题或解决方法?计划是在我们让发布步骤正常工作的同时将其推向Octopus部署。

2 个解决方案

#1


1  

You cannot pass multiple projects / arguments to dotnet publish.

您不能将多个项目/参数传递给dotnet发布。

In your case you seem to have passed the artifacts folder as second argument. To do this, add -o before that directory:

在您的情况下,您似乎已将artifacts文件夹作为第二个参数传递。为此,请在该目录之前添加-o:

dotnet publish your.csproj -o $(Build.ArtifactStagingDirectory)

#2


0  

Changing to pass -o as parameter instead of only $(Build.ArtifactStagingDirectory) did the trick as Martin stated above, and final configuration as below.

更改为传递-o作为参数而不仅仅是$(Build.ArtifactStagingDirectory),就像Martin上面所说的那样,以及最终配置如下所示。

“dotnet publish”(.net core)构建步骤不适用于具有多个项目的visual studio团队服务

#1


1  

You cannot pass multiple projects / arguments to dotnet publish.

您不能将多个项目/参数传递给dotnet发布。

In your case you seem to have passed the artifacts folder as second argument. To do this, add -o before that directory:

在您的情况下,您似乎已将artifacts文件夹作为第二个参数传递。为此,请在该目录之前添加-o:

dotnet publish your.csproj -o $(Build.ArtifactStagingDirectory)

#2


0  

Changing to pass -o as parameter instead of only $(Build.ArtifactStagingDirectory) did the trick as Martin stated above, and final configuration as below.

更改为传递-o作为参数而不仅仅是$(Build.ArtifactStagingDirectory),就像Martin上面所说的那样,以及最终配置如下所示。

“dotnet publish”(.net core)构建步骤不适用于具有多个项目的visual studio团队服务