繁体   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