簡體   English   中英

無法在VS2015中運行NuGet Package Command

[英]Cannot run NuGet Package Command in VS2015

我在同一台機器上做過很多次這樣的項目,但由於某種原因,以下內容對我不起作用:

  1. 從NuGet包管理器添加所需的DLL(在本例中為filehelpers)
  2. 安裝Costura.Fody(默認情況下它包括Fody 2.0.6; 2.0.7可用我嘗試了兩個版本產生相同的結果)
  3. 使用程序包管理器控制台運行命令Install-CleanReferencesTarget (從https://github.com/Fody/Costura復制/粘貼)

當我到達第三步(到目前為止一直工作)時,我收到以下錯誤:

PM> Install-CleanReferencesTarget
Install-CleanReferencesTarget : The term 'Install-CleanReferencesTarget' is not recognized
as the name of a cmdlet, function, script file, or operable program. Check the spelling of
the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Install-CleanReferencesTarget
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Install-CleanReferencesTarget:String) [],
                              CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

我已經嘗試重新創建項目,重新啟動我的電腦,重新啟動VS,運行VS作為管理員等,但結果相同。 我還驗證了有問題的DLL(FileHelpers.dll)設置為復制本地。

我還查看了包含相同DLL的另一個項目中的FodyWeavers.xml文件,並且沒有此問題,並且它與此麻煩項目中的相同:

<?xml version="1.0" encoding="utf-8" ?>
<Weavers>
  <Costura/>
</Weavers>

有誰知道為什么會突然發生這種情況?

根據最新的文檔 ,似乎已在較新版本中刪除,這將自動啟用該功能。 可以通過更改Costura配置文件來禁用清理。

DisableCleanup

作為Costura的一部分,嵌入式組件不再作為構建的一部分包含在內。 可以關閉此清理。

默認為false

 <Costura DisableCleanup='true' /> 

有關配置選項的更多詳細信息,另請參閱此帖子

  1. 打開NuGet包管理控制台(View-> Other Windows)並使用命令行選項,從這里:創建和發布包[^]
  2. 從源代碼編譯:NuGet Package Project擴展[^](來源在這里:主頁[^])

這不是一個答案,但我只是遇到了同樣的問題,並設法找到了解決方法。

最后,而不是使用該cmdlet,我從底部添加目標到我的凸出文件在這里 這似乎有效。

暫無
暫無

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

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