gpt4 book ai didi

ASP.NET Core 3.1 publish github action self-hosted issue while restore - nupkg used by another process(ASP.NET Core 3.1发布GitHub操作自托管问题,同时恢复另一个进程使用的nupkg)

转载 作者:bug小助手 更新时间:2023-10-28 20:30:43 25 4
gpt4 key购买 nike



I have an Asp.Net core 3.1 project for each i have created a github workflow which runs as self-hosted and publishes and deployment. The self hosted runner is installed in a linux machine. My project has also dependency on two vb.net projects. The publish command command looks like this: dotnet publish --framework netcoreapp3.1 --runtime linux-x64 -c Release.

我有一个ASP.NET核心3.1项目,每个项目我都创建了一个GitHub工作流,它以自托管方式运行,并进行发布和部署。自托管运行器安装在Linux计算机上。我的项目也依赖于两个vb.net项目。PUBLISH命令如下所示:DotNet发布--框架netcoreapp3.1--运行时linux-x64-c版本。


Problem is that most of the time i try to publish i get an error message telling that nupkg file of the dependent project is used by another process:

问题是,在我尝试发布的大部分时间里,我收到一条错误消息,告诉我依赖项目的nupkg文件正被另一个进程使用:



2023-09-09T14:51:11.8089410Z
/home/gitrunner/.dotnet/sdk/3.1.426/Sdks/NuGet.Build.Tasks.Pack/build/NuGet.Build.Tasks.Pack.targets(198,5):
error : The process cannot access the file
'/home/gitrunner/actions-runner/_work/ApiProject/ApiProject/Dep1/dep1/bin/Release/dep1.1.0.0.nupkg'
because it is being used by another process.
[/home/gitrunner/actions-runner/_work/ApiProject/ApiProject/Dep1/dep1/ApiProject.vbproj]



Any idea what could be the problem? Tried different ways to publish also by restoring first but no luck. Any help is greatly appreciated.

你知道问题出在哪里吗?也尝试了不同的发布方式,首先恢复,但没有成功。如有任何帮助,我们不胜感激。


更多回答

Before attempting to publish, clean and rebuild your solution. This can help ensure that all the build artifacts are up-to-date and not locked by other processes.

在尝试发布、清理和重新生成您的解决方案之前。这有助于确保所有构建构件都是最新的,并且不会被其他进程锁定。

Tried cleaning up as well. The issue with this thing is that some time works ok...

我也试过清理。这件事的问题是,有些时候行得通……

It's possible that another build or publish process is still running and holding a lock on the file. You can use system tools like lsof on Linux to identify processes that might be using the file

另一个构建或发布进程可能仍在运行并锁定该文件。您可以在Linux上使用像lsof这样的系统工具来识别可能正在使用该文件的进程

优秀答案推荐

It seems that i needed to restore the depended projects first. Restore the main project with --no-dependencies flag and then publish with --no-release mode. Something like the following:

看来我需要先恢复依赖的项目。使用--no-Dependents标志恢复主项目,然后使用--no-Release模式发布。类似于以下内容:


 dotnet restore DependentProject1
dotnet restore DependentProject2
dotnet restore MainProject --no-dependencies
dotnet publish MainProject -c Release --no-restore

更多回答

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com