我已经使用一个空的web应用程序和nuget服务器包设置了一个私有的nuget提要。这一切都在工作,我可以从提要中检索,我可以使用Nuget Package Explorer发布到私有提要。但我不能通过命令行发布-它会提示输入凭据。我已经在Appsettings中将web应用程序中的ApiKey设置为一个简单的密码,并尝试将ApiKey添加到push命令中。这会提示我输入用户名,然后输入密码。我也尝试过SetApiKey命令,但我得到了相同的行为。在构建服务器上,我正在尝试同样的事情,但结果相同。
以下是来自构建日志的错误消息(识别信息x’d out)
nuget pack "C:Builds2OE Phase IICommonsrcWebApiWeb.HttpBxxxxxxxs.Web.Http.csproj" -IncludeReferencedProjects -Properties Configuration=Release
nuget SetApiKey Bxxxxxxx1 -Source http://tfs12.xxxxxxxrps.com/Nuget
nuget push *.nupkg -s http://tfs12.xxxxxxxrps.com/Nuget/
C:Builds2OE Phase IICommonbinxxxxxxx.Web.Http.dll
1 File(s) copied
Attempting to build package from 'xxxxxxx.Web.Http.csproj'.
Packing files from 'C:Builds2OE Phase IICommonsrcWebApiWeb.HttpbinRelease'.
Using 'xxxxxxxs.Web.Http.nuspec' for metadata.
Found packages.config. Using packages listed as dependencies
Successfully created package 'C:Builds2OE Phase IICommonbinxxxxxxxs.Web.Http.1.0.0.0.nupkg'.
The API Key 'xxxxxxx' was saved for 'http://tfs12.xxxxxxxrps.com/Nuget'.
Pushing Bxxxxxxxrs.Data 1.0.0.0 to 'http://tfs12.xxxxxxxrps.com/Nuget/'...
Please provide credentials for: http://tfs12.xxxxxxxrps.com/Nuget/
Object reference not set to an instance of an object.
UserName: Password:
找到适用于Windows Server 2012和Nuget.Server 2.8.5 的解决方案
- 打开IIS管理器
- 查找您的"Nuget.Server"应用程序
- 右键单击并选择"编辑权限"
- 转到"安全"选项卡
为组"Everyone"添加"写入"权限。
neneneba API键用于上传/推送包。看起来您启用了http代理,可以通过调用nuget.exe config命令来设置用户名和密码。
例如:
nuget-config-设置HTTP_PROXY=HTTP://*.*..-设置HTTPPROXY.USER=domain\USER
nuget.config HTTP_PROXY
http://docs.nuget.org/docs/reference/command-line-reference
这对我很有效:站点>身份验证>启用Windows身份验证(默认情况下我只有匿名身份验证),推送将在没有用户输入的情况下使用您的域帐户。
我也有这个问题,我以前就知道它有效,结果发现我使用的是NuGet.exe 2.8.1,使用升级
NuGet.exe update -self
将其提高到2.8.3,现在运行良好。
另外,您使用了哪个版本的NuGet.Server包?NuGet已经发布了它的2.7.2版本。
你能试着看看null ref异常是否还能重新出现吗?谢谢
您可能会发现这个SO答案很有用,因为它涵盖了如何在工作站和/或构建服务器上配置凭据,需要通过命令行将凭据推送到需要身份验证的服务器(例如私有提要)
发布不需要API密钥。