簡體   English   中英

Visual Studio 從 Debug 目錄中刪除所有 dll、pdb、xml 文件,並且在我嘗試發布應用程序時需要發布 - 如何恢復它們?

[英]Visual Studio deletes all dll, pdb, xml files from Debug directory and requires publishing when I tried to publish application - how to restore them?

I am developing .NET 4.6.1 Console application with NuGet packages in with Visual Studio 2019 Community Edition and VS places all the NuGet-retrieved dll and compiled pdb, xml files in src/Debug directory. 我猜它是默認的。

我的項目成功編譯,可以調試和執行。 但后來我試圖發布它。 我收到錯誤消息Error An error occurred while signing: Failed to sign bin\Debug\app.publish\MyApplication.exe. SignTool Error: Invalid option: /fd com.mycompany.myapplication Error An error occurred while signing: Failed to sign bin\Debug\app.publish\MyApplication.exe. SignTool Error: Invalid option: /fd com.mycompany.myapplication and I could see that all the dll, pdb and xml files are deleted from my Debug directory and new directory bin\Debug\app.publish has been created but with the exe file只要。

所以 - 在我嘗試發布應用程序后,發生了 2 件壞事:

  1. NuGet 軟件包中的 dll 已被刪除,因此我無法再運行我的 exe 文件;
  2. 現在,每次我嘗試重建項目時,Visual Studio 都會嘗試發布應用程序。 並且此發布失敗並顯示Failed to sign bin\Debug\app.publish\MyApplication.exe. SignTool Error: Invalid option: /fd com.mycompany.myapplication Failed to sign bin\Debug\app.publish\MyApplication.exe. SignTool Error: Invalid option: /fd com.mycompany.myapplication ,因此我什至無法重建我的 exe 文件。

如何將 Rebuild 與發布分離,以及如何在 Rebuild 期間不進行發布? 以及如何從我的 Debug 目錄中的 NuGet 包中恢復 dll? 即如何撤消自從我嘗試發布應用程序以來開始發生的所有壞事?

我遵循了 https://stackoverflow.com/a/56739494/1375882並使用 sha1RSA 執行了“創建測試證書...”,然后發布和重建都按預期進行,甚至 dll/pdb/xml 文件也會在我的調試目錄。 所以,這解決了這個問題,但可能以次優的方式......

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM