Powershell nuget.exe的本地副本在nuget.org上找不到任何包

Powershell nuget.exe的本地副本在nuget.org上找不到任何包,powershell,nuget,Powershell,Nuget,我一直在使用和转换.NET配置文件 该脚本的要点是,它下载一个本地版本的nuget.exe,然后使用它下载将用于XDT转换的nuget包 我的问题是,当它调用一行来下载NuGet包时,我被告知无法找到该包。例如 找不到包“Microsoft.Web.Xdt”的版本“3.1.0” …尽管nuget.org明确声明这是有效的-。我已经用其他软件包和它们公开声明的版本尝试过了,并且收到了相同的消息 另一点需要注意的是,我们有自己的私有NuGet提要。当我运行Powershell脚本时,它还将尝试搜索该

我一直在使用和转换.NET配置文件

该脚本的要点是,它下载一个本地版本的nuget.exe,然后使用它下载将用于XDT转换的nuget包

我的问题是,当它调用一行来下载NuGet包时,我被告知无法找到该包。例如

找不到包“Microsoft.Web.Xdt”的版本“3.1.0”

…尽管nuget.org明确声明这是有效的-。我已经用其他软件包和它们公开声明的版本尝试过了,并且收到了相同的消息

另一点需要注意的是,我们有自己的私有NuGet提要。当我运行Powershell脚本时,它还将尝试搜索该提要,我不希望它这样做,因此我在与Powershell脚本相同的目录中添加了一个
nuget.config
文件(我也在与本地nuget.exe相同的目录中尝试过),在该目录中,我已禁用了自定义的nuget源代码

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
  </packageSources>
  <disabledPackageSources>
    <add key="DevOps" value="true" />
  </disabledPackageSources>
  <packageRestore>
    <add key="enabled" value="True" />
    <add key="automatic" value="True" />
  </packageRestore>
  <bindingRedirects>
    <add key="skip" value="False" />
  </bindingRedirects>
  <packageManagement>
    <add key="format" value="0" />
    <add key="disabled" value="False" />
  </packageManagement>
</configuration>

除了
部分之外,这个nuget.config的其余部分是从我的机器级别nuget.config复制的


有人能解释为什么nuget.exe的本地实例无法从nuget.org找到任何包吗?

通过提供的nuget.exe,您能在CLI cmd中提供
nuget source
的输出,并检查
nuget list
是否输出任何内容吗?(未签名,我建议您使用提供签名可执行文件的源代码,并使用本地
signtool.exe
)自动检查签名!Aha!
\nuget.exe源代码
显示“[已禁用]”,这让我感到困惑,因为它与nuget.exe旁边的nuget.config文件的内容不一致。
\nuget.exe list
返回“未找到任何包”我想您必须在脚本中使用
-ConfigFile
明确指定nuget.config路径。另外,请检查提供的
nuget.exe
可能早于3.4,然后为其配置文件查找
.nuget
子目录。