繁体   English   中英

将所有程序包推送到远程NuGet提要

[英]Push all packages to remote NuGet feed

我正在尝试将我的应用程序迁移到新的.Net Core 1.0。 我的构建服务器无法访问互联网,因此我设置了在构建服务器上运行的本地NuGet服务器。

有没有办法让我的脚本读取我的解决方案,并将所有新的和更新的程序包推送到远程NuGet服务器?

我环顾四周,发现您应该能够将这些行放在project.json文件中,它将所有包推送到服务器。

  "scripts": {
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ],
    "postcompile": [
      "dotnet pack --no-build",
      "\"%project:Directory%\\..\\..\\nuget.exe\" push \"%project:Directory%\\bin\\%compile:Configuration%\\%project:Name%.%project:Version%.nupkg\" -source http://xx.xxx.xx.xx/nuget -ApiKey "
    ]
  },

但是,在dotnet pack --no-build完成后,我得到了一个错误。

The system cannot find the file specified C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets

如果我双击错误,它将打开文件并转到

<Dnx
  RuntimeExe="$(SDKToolingExe)"
  Condition="'$(_DesignTimeHostBuild)' != 'true'"
  ProjectFolder="$(MSBuildProjectDirectory)"
  Arguments="$(_BuildArguments)"
  />

关于其他解决方案有什么建议吗?

我认为common.targets部分是一条红色鲱鱼。 nuget.exe或推送路径很可能不太正确。

我要做的是将nuget push命令放在.cmd文件中,将文件路径作为参数传递,然后查看输出窗口以查看nuget使用的实际参数。 验证到nuget exe和nupkg的路径均正确。 您可能在路径中缺少framework文件夹。 例如,对我来说,我的道路将更像

%project:Directory%\\bin\\%compile:Configuration%\\%compile:TargetFramework%\\%project:Name%.%project:Version%.nupkg

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM