如何解决dotnet包最近失败
我们在Azure Devops中已经很长时间收到NU5118错误,但是打包步骤正在通过
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,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),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
解决方法
我可以确认我们已经看到了完全相同的行为,没有对我们的构建管道或源代码进行任何更改。第一个失败的构建在任务日志顶部的横幅中也有Version : 2.173.0
。
在我们的例子中,该错误是由于多个相关的nuget软件包所致,这些软件包都包含一个.targets文件,其元素为:
<Content Include="Deployment\**\*.*" Pack="true" PackagePath="\..\Deployment\" />
该错误一直记录在任务中,只有以前的版本忽略了该错误并仍然通过了构建。由于nuget pack
尽管出现错误,仍会发出.nupkg文件,所以此方法有效。
我们的解决方法是在包含之前添加一个Remove元素:
<Content Remove="Deployment\**\*.*" />
<Content Include="Deployment\**\*.*" Pack="true" PackagePath="\..\Deployment\" />
,
您提供的日志显示错误发生的原因是您的.NET Core SDK /运行时版本太旧。
推荐的解决方案是在原始任务之前添加一个UseDotNet
任务:
- task: UseDotNet@2
inputs:
version: {version}
您也可以将自托管代理与所需的.NET Core SDK /运行时版本一起使用,而不是托管代理,也可以使用更新的版本。但是这两种解决方案都会极大地改变建筑环境,因此需要根据您的情况谨慎使用。
,dotnet包最近失败
根据错误消息:
错误NU5118:未添加文件'Create-Identity.sql',因为 程序包已经包含文件'content \ Create-Identity.sql'
似乎您在项目中拥有let bar = new ProgressBar.SemiCircle(npsbar,{
strokeWidth: 10,easing: 'easeInOut',duration: 1400,color: 'tomato',trailColor: '#eee',trailWidth: 1,svgStyle: null
});
bar.trail.setAttribute('stroke-linecap','round');
bar.path.setAttribute('stroke-linecap','round');
bar.animate(0.8);
,并且有多个文件具有相同的文件名。那就是说包裹已经包含文件的原因。
要解决此问题,最简单的方法是删除同一文件或在可能的情况下重命名它们。
如果我们无法删除或重命名这些文件,则可以尝试将IncludeSource=true
文件与其他文件放在不同的目标路径中。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。