错误NETSDK1085:“ NoBuild”属性设置为true,但是调用了“ Build”目标

时间:2019-12-11 15:34:59

标签: .net .net-core

我在一个项目中遇到以下问题。我在构建服务器上的两个单独步骤中构建并创建一个发布包。问题在于,对于这个特定项目,发布失败并显示以下日志。

root@a5895b63fc16:/workspaces/Project.Backend# dotnet build src/Project.Backend.Graph -c Release -r ubuntu.18.04-x64
Microsoft (R) Build Engine version 16.3.0+0f4c62fea for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 7.27 sec for /workspaces/Project.Backend/src/Project.Backend.Graph.Objects/Project.Backend.Graph.Objects.csproj.
  Restore completed in 7.27 sec for /workspaces/Project.Backend/src/Project.Backend.Common/Project.Backend.Common.csproj.
  Restore completed in 8.58 sec for /workspaces/Project.Backend/src/Project.Backend.Graph/Project.Backend.Graph.csproj.
  Project.Backend.Common -> /workspaces/Project.Backend/src/Project.Backend.Common/bin/Release/netcoreapp3.0/Project.Backend.Common.dll
  Project.Backend.Graph.Objects -> /workspaces/Project.Backend/src/Project.Backend.Graph.Objects/bin/Release/netcoreapp3.0/Project.Backend.Graph.Objects.dll
  Project.Backend.Graph -> /workspaces/Project.Backend/src/Project.Backend.Graph/bin/Release/netcoreapp3.0/ubuntu.18.04-x64/Project.Backend.Graph.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:01:07.42
root@a5895b63fc16:/workspaces/Project.Backend# dotnet publish src/Project.Backend.Graph -c Release -r ubuntu.18.04-x64 -o tmp/Graph/ --no-restore --no-build -v n
Microsoft (R) Build Engine version 16.3.0+0f4c62fea for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 12/11/2019 4:08:26 PM.
     1>Project "/workspaces/Project.Backend/src/Project.Backend.Graph/Project.Backend.Graph.csproj" on node 1 (Publish target(s)).
     1>Project "/workspaces/Project.Backend/src/Project.Backend.Graph/Project.Backend.Graph.csproj" (1) is building "/workspaces/Project.Backend/src/Project.Backend.Common/Project.Backend.Common.csproj" (3:4) on node 2 (GetCopyToPublishDirectoryItems target(s)).
     3>OrleansGenerateCode:
       Skipping target "OrleansGenerateCode" because all output files are up-to-date with respect to the input files.
     3>Done Building Project "/workspaces/Project.Backend/src/Project.Backend.Common/Project.Backend.Common.csproj" (GetCopyToPublishDirectoryItems target(s)).
     1>Project "/workspaces/Project.Backend/src/Project.Backend.Graph/Project.Backend.Graph.csproj" (1) is building "/workspaces/Project.Backend/src/Project.Backend.Graph.Objects/Project.Backend.Graph.Objects.csproj" (2:4) on node 1 (GetCopyToPublishDirectoryItems target(s)).
   2:4>Project "/workspaces/Project.Backend/src/Project.Backend.Graph.Objects/Project.Backend.Graph.Objects.csproj" (2:4) is building "/workspaces/Project.Backend/src/Project.Backend.Common/Project.Backend.Common.csproj" (3:6) on node 2 (default targets).
     3>/usr/share/dotnet/sdk/3.0.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(133,5): error NETSDK1085: The 'NoBuild' property was set to true but the 'Build' target was invoked. [/workspaces/Project.Backend/src/Project.Backend.Common/Project.Backend.Common.csproj]
     3>Done Building Project "/workspaces/Project.Backend/src/Project.Backend.Common/Project.Backend.Common.csproj" (default targets) -- FAILED.
     2>Done Building Project "/workspaces/Project.Backend/src/Project.Backend.Graph.Objects/Project.Backend.Graph.Objects.csproj" (GetCopyToPublishDirectoryItems target(s)) -- FAILED.
     1>Done Building Project "/workspaces/Project.Backend/src/Project.Backend.Graph/Project.Backend.Graph.csproj" (Publish target(s)) -- FAILED.

Build FAILED.

       "/workspaces/Project.Backend/src/Project.Backend.Graph/Project.Backend.Graph.csproj" (Publish target) (1) ->
       "/workspaces/Project.Backend/src/Project.Backend.Graph.Objects/Project.Backend.Graph.Objects.csproj" (GetCopyToPublishDirectoryItems target) (2:4) ->
       "/workspaces/Project.Backend/src/Project.Backend.Common/Project.Backend.Common.csproj" (default target) (3:6) ->
       (_CheckForBuildWithNoBuild target) -> 
         /usr/share/dotnet/sdk/3.0.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(133,5): error NETSDK1085: The 'NoBuild' property was set to true but the 'Build' target was invoked. [/workspaces/Project.Backend/src/Project.Backend.Common/Project.Backend.Common.csproj]

    0 Warning(s)
    1 Error(s)

项目文件:

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>netcoreapp3.0</TargetFramework>
        <LangVersion>latest</LangVersion>
    </PropertyGroup>
    <PropertyGroup>
        <ServerGarbageCollection>true</ServerGarbageCollection>
        <ConcurrentGarbageCollection>true</ConcurrentGarbageCollection>
    </PropertyGroup>
    <PropertyGroup>
        <CodeAnalysisRuleSet>..\stylecop.ruleset</CodeAnalysisRuleSet>
    </PropertyGroup>
    <ItemGroup>
        <AdditionalFiles Include="..\stylecop.json" Link="stylecop.json" />
    </ItemGroup>
    <ItemGroup>
        <PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="3.0.0" />
        <PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="3.0.0" />
        <PackageReference Include="Microsoft.Extensions.Hosting" Version="3.0.0" />
        <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.0.0" />
        <PackageReference Include="Microsoft.Orleans.Persistence.AzureStorage" Version="2.4.2" />
        <PackageReference Include="Microsoft.Orleans.Reminders.AzureStorage" Version="2.4.2" />
        <PackageReference Include="Microsoft.Orleans.Server" Version="2.4.2" />
    </ItemGroup>
    <ItemGroup>
        <PackageReference Include="VU.Platform.Common" Version="1.2.0-20191127.1" />
    </ItemGroup>
    <ItemGroup>
        <ProjectReference Include="..\Project.Backend.Common\Project.Backend.Common.csproj" />
        <ProjectReference Include="..\Project.Backend.Graph.Objects\Project.Backend.Graph.Objects.csproj" />
    </ItemGroup>
    <ItemGroup>
        <None Include="appsettings.json" CopyToOutputDirectory="Always" />
    </ItemGroup>
</Project>

0 个答案:

没有答案