我们在Azure Devops中收到NU5118错误已经有很长一段时间了,但是pack步骤正在通过
Starting: Pack
==============================================================================
Task : .NET Core
Description : Build, test, package, or publish a dotnet application, or run a custom dotnet command
Version : 2.167.1
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/dotnet-core-cli
==============================================================================
C:\windows\system32\chcp.com 65001
Active code page: 65001
e:\vsts\a\_tool\dotnet\dotnet.exe pack e:\vsts\a\4674\s\src\Bentley.Interoperability.APM\Bentley.Interoperability.APM.csproj --configuration Release -o e:\vsts\a\4674\a/nuget /p:Version=1.0.86.0 --no-build --no-restore
Microsoft (R) Build Engine version 16.5.0+d4cbfca49 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
e:\vsts\a\_tool\dotnet\sdk\3.1.201\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(198,5): error NU5118: File 'C:\Users\prgremotebuilder\.nuget\packages\bentley.interoperability.identityservice.oracle\1.0.69\contentFiles\any\netstandard2.0\scripts\oracle\Create-Identity.sql' is not added because the package already contains file 'content\Create-Identity.sql' [e:\vsts\a\4674\s\src\Bentley.Interoperability.APM\Bentley.Interoperability.APM.csproj]
e:\vsts\a\_tool\dotnet\sdk\3.1.201\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(198,5): error NU5118: File 'C:\Users\prgremotebuilder\.nuget\packages\bentley.interoperability.identityservice.oracle\1.0.69\contentFiles\any\netstandard2.0\scripts\oracle\Create-Identity.sql' is not added because the package already contains file 'contentFiles\any\netstandard2.1\Create-Identity.sql' [e:\vsts\a\4674\s\src\Bentley.Interoperability.APM\Bentley.Interoperability.APM.csproj]
e:\vsts\a\_tool\dotnet\sdk\3.1.201\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(198,5): error NU5118: File 'C:\Users\prgremotebuilder\.nuget\packages\bentley.interoperability.identityservice.oracle\1.0.69\contentFiles\any\netstandard2.0\scripts\oracle\Identity-SP.sql' is not added because the package already contains file 'content\Identity-SP.sql' [e:\vsts\a\4674\s\src\Bentley.Interoperability.APM\Bentley.Interoperability.APM.csproj]
e:\vsts\a\_tool\dotnet\sdk\3.1.201\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(198,5): error NU5118: File 'C:\Users\prgremotebuilder\.nuget\packages\bentley.interoperability.identityservice.oracle\1.0.69\contentFiles\any\netstandard2.0\scripts\oracle\Identity-SP.sql' is not added because the package already contains file 'contentFiles\any\netstandard2.1\Identity-SP.sql' [e:\vsts\a\4674\s\src\Bentley.Interoperability.APM\Bentley.Interoperability.APM.csproj]
Successfully created package 'e:\vsts\a\4674\a\nuget\Bentley.Interoperability.APM.1.0.86.nupkg'.
Info: Azure Pipelines hosted agents have been updated to contain .Net Core 3.x (3.0 and 3.1) SDK/Runtime along with 2.1. Unless you have locked down a SDK version for your project(s), 3.x SDK might be picked up which might have breaking behavior as compared to previous versions.
Some commonly encountered changes are:
If you're using `Publish` command with -o or --Output argument, you will see that the output folder is now being created at root directory rather than Project File's directory. To learn about more such changes and troubleshoot, refer here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting
Finishing: Pack但现在它失败了:
它有相同的错误信息,但现在还有“Dotnet命令失败,以下项目的退出代码不为零...”
Starting: Nuget: Pack
==============================================================================
Task : .NET Core
Description : Build, test, package, or publish a dotnet application, or run a custom dotnet command
Version : 2.173.0
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/dotnet-core-cli
==============================================================================
C:\windows\system32\chcp.com 65001
Active code page: 65001
Info: .NET Core SDK/runtime 2.2 and 3.0 are now End of Life(EOL) and have been removed from all hosted agents. If you're using these SDK/runtimes on hosted agents, kindly upgrade to newer versions which are not EOL, or else use UseDotNet task to install the required version.
e:\vsts\b\_tool\dotnet\dotnet.exe pack e:\vsts\b\6232\s\src\Bentley.Interoperability.APM\Bentley.Interoperability.APM.csproj --configuration Release -o e:\vsts\b\6232\a/nuget /p:Version=1.0.244.0 --no-build
Microsoft (R) Build Engine version 16.7.0-preview-20360-03+188921e2f for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
e:\vsts\b\_tool\dotnet\sdk\3.1.401\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(198,5): error NU5118: File 'C:\Users\prgremotebuilder\.nuget\packages\bentley.interoperability.identityservice.oracle\1.0.69\contentFiles\any\netstandard2.0\scripts\oracle\Create-Identity.sql' is not added because the package already contains file 'content\Create-Identity.sql' [e:\vsts\b\6232\s\src\Bentley.Interoperability.APM\Bentley.Interoperability.APM.csproj]
e:\vsts\b\_tool\dotnet\sdk\3.1.401\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(198,5): error NU5118: File 'C:\Users\prgremotebuilder\.nuget\packages\bentley.interoperability.identityservice.oracle\1.0.69\contentFiles\any\netstandard2.0\scripts\oracle\Create-Identity.sql' is not added because the package already contains file 'contentFiles\any\netstandard2.1\Create-Identity.sql' [e:\vsts\b\6232\s\src\Bentley.Interoperability.APM\Bentley.Interoperability.APM.csproj]
e:\vsts\b\_tool\dotnet\sdk\3.1.401\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(198,5): error NU5118: File 'C:\Users\prgremotebuilder\.nuget\packages\bentley.interoperability.identityservice.oracle\1.0.69\contentFiles\any\netstandard2.0\scripts\oracle\Identity-SP.sql' is not added because the package already contains file 'content\Identity-SP.sql' [e:\vsts\b\6232\s\src\Bentley.Interoperability.APM\Bentley.Interoperability.APM.csproj]
e:\vsts\b\_tool\dotnet\sdk\3.1.401\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(198,5): error NU5118: File 'C:\Users\prgremotebuilder\.nuget\packages\bentley.interoperability.identityservice.oracle\1.0.69\contentFiles\any\netstandard2.0\scripts\oracle\Identity-SP.sql' is not added because the package already contains file 'contentFiles\any\netstandard2.1\Identity-SP.sql' [e:\vsts\b\6232\s\src\Bentley.Interoperability.APM\Bentley.Interoperability.APM.csproj]
##[error]Error: The process 'e:\vsts\b\_tool\dotnet\dotnet.exe' failed with exit code 1
Info: Azure Pipelines hosted agents have been updated to contain .Net Core 3.x (3.1) SDK/Runtime along with 2.1. Unless you have locked down a SDK version for your project(s), 3.x SDK might be picked up which might have breaking behavior as compared to previous versions.
Some commonly encountered changes are:
If you're using `Publish` command with -o or --Output argument, you will see that the output folder is now being created at root directory rather than Project File's directory. To learn about more such changes and troubleshoot, refer here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting
##[error]Dotnet command failed with non-zero exit code on the following projects : e:\vsts\b\6232\s\src\Bentley.Interoperability.APM\Bentley.Interoperability.APM.csproj
Finishing: Nuget: Pack发布于 2020-08-27 21:20:30
我可以确认,我们已经看到了完全相同的行为,而我们没有对构建管道或源代码进行任何更改。第一个失败的构建在任务日志顶部的横幅中也有Version : 2.173.0。
在我们的例子中,错误是由于多个依赖的nuget包导致的,这些包都包含一个.targets文件,其中的元素如下:
<Content Include="Deployment\**\*.*" Pack="true" PackagePath="\..\Deployment\" />错误一直由任务记录,只有以前的版本忽略了它,并且仍然通过了构建。这是因为尽管出现错误,nuget pack仍会发出.nupkg文件。
我们的解决方法是在include之前添加一个Remove元素:
<Content Remove="Deployment\**\*.*" />
<Content Include="Deployment\**\*.*" Pack="true" PackagePath="\..\Deployment\" />发布于 2020-08-21 16:04:54
您提供的日志显示该错误是由于您的.NET Core SDK/运行时版本太旧而导致的。
推荐的解决方案是在原始任务之前添加UseDotNet任务:
- task: UseDotNet@2
inputs:
version: {version}您还可以将自托管代理与您想要的.NET Core SDK/运行时版本一起使用,而不是托管代理,或者使用较新的版本。但这两种解决方案都会显著改变建筑环境,因此需要根据您的情况谨慎使用。
发布于 2020-08-28 16:46:18
dotnet包最近出现故障
根据错误消息:
错误NU5118:未添加文件'Create-Identity.sql‘,因为包已包含文件'content\Create-Identity.sql’
似乎项目中有IncludeSource=true,而中有几个文件具有相同的文件名。这就是为什么它说包已经包含文件的原因。
要解决此问题,最简单的方法是删除相同的文件或重命名(如果可能)。
如果我们无法删除或重命名这些文件,我们可以尝试使用不同目标路径中的这些文件来创建nuspec文件。
https://stackoverflow.com/questions/63509317
复制相似问题