[英]Make dotnet publish use dependencies from bin folder and not from nuget cache
在我的 CI 中,我在不同階段構建並發布 .net 應用程序。
在構建階段,我進行dotnet build
並創建obj
和bin
文件夾。 然后我將這兩個文件夾傳遞給發布階段並運行dotnet publish -o pub --no-build
,但 msbuild 嘗試從 nuget 緩存文件夾( .nuget/packages
)而不是bin
復制依賴項。
有沒有辦法讓dotnet publish
使用bin
文件夾中的依賴項? 我不想從第一階段傳遞整個.nuget
文件夾,因為無論如何所有依賴項都已經存儲在bin
中。
我可以問一下,當dotnet publish
默認在后台構建時,為什么需要顯式dotnet build
? 也許這可以幫助?
如果包緩存的一致性是目標,另一種方法是顯式執行dotnet restore
(甚至可能是代理臨時文件夾),然后在dotnet build
和dotnet restore
中使用 package 緩存。
dotnet restore app\app.csproj
dotnet build app\app.csproj --no-restore
dotnet publish app\app.csproj -o pub --no-restore
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.