从副本发布nuget包 [英] publish a nuget package from a copy

查看:57
本文介绍了从副本发布nuget包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看来我的队友已经关闭了他们的nuget服务器,然后放假了.我需要临时解决,以便还原nuget程序包时我的Azure Dev Ops构建不会失败.

我在以下位置有该软件包的本地副本

C:\ Users \ kirst.nuget \ packages \ mypackagetemp

我想发布到临时供稿.

我阅读了

对我来说,我已经在其中推送了自定义的 LibraryCore.nupkg .现在,我们单击连接到提要"设置,选择" nuget.exe ",您将看到:

将完全相同的内容复制到您自己的 mynuget.config 文件中.然后,您的构建管道可以访问您发布的 mypackagetemp.nupkg .

无法从以下位置获取有关"Serilog.Enrichers.Thread"的信息远程源'

此外:

根据您的描述,除了使用 mynuget.config 外,您只需要使用 nuget.org 中的自定义devops feed和其他软件包,就可以配置您的 nuget restore 任务如下:

通过我在此处选择的直接选择devops feed(第二条红线),而不是 Nuget.config 中的Feed.并选中使用nuget.org中的软件包复选框.然后,您可以在构建过程中访问自定义feed和nuget.org中的软件包.

It seems my team mates have turned off their nuget server and gone on holidays. I need a temporary work around so that my Azure Dev Ops build does not fail when restoring the nuget packages.

I have a local copy of the package at

C:\Users\kirst.nuget\packages\mypackagetemp

Which I want to publish to a temporary feed.

I read the instructions on publishing a package from the command line but am confused about step 6 Surely I dont need to set up the Project and restore packages as I already have the .nupkg

I tried the command

c:\nuget\nuget.exe push -Source "TempFeed" -ApiKey az mypackagetemp.nupkg

but got an error

unable to load the service index for source https://pkgs.dev.azure.com/mycompany/myproject/_packageing/TempFeed/nuget/v3/index.json

When I repeat the command I get a request for credentials When I put in the credentials I connect to Azure Dev Ops with they do not work.

[Update]

I was prompted for credentials.. reading up on it... so confusing.

[Update]

I upgraded nuget.exe from 5.1.0.6013 to the latest version 5.4.0.6315 This time I got a UI to log in and the message

Your package was pushed

However when the devops pipeline build runs I het a message

unable to load the service index for source
https://pkgs.dev.azure.com/mycompany/myproject/_packageing/TempFeed/nuget/v3/index.json

I guess I need to create an index.json file somehow.

My project is using a mynuget.config that has the following in the packagesources

 <add key="TempPackage" value="https://pkgs.dev.azure.com/mycompany/_packaging/myfeed/nuget" />

[Update]

I changed mynuget.config to have

  <add key="TempPackage" value="https://pkgs.dev.azure.com/mycompany/_packaging/myfeed/nuget/v3/index.json" />

Now the dev ops build shows the message

Failed to retrieve information about 'Serilog.Enrichers.Thread' from remote source 'https://pkgs.dev.azure.com/mycompany/_packaging/myfeed/nuget/FindPackagesById()?id="Serilog.Enrichers.Thread'', response status code does not indicate success: 404 (Not Found).)

My solution does use Serilog. I don't think the 3rd party package uses it.

[Update]

The next time I built I got a different error looking for WindowsAzure.Storage

I seem to get a different file causing the error each time I build the pipeline.

My project artifacts does have 2 feeds. The needed files are in the unselected feed.

[Update]

I tried editing mynuget.config to use index.json however I get a build error

The nuget command failed with exit code(1) and error(Unable to load the service index for source https://pkgs.dev.azure.com/mycompany/_packaging/myfeed/nuget/v3/index.json. Response status code does not indicate success: 404 (Not Found - The feed with ID 'MyFeed' doesn't exist

[Update]

Because the new feed was project based I edited mynuget.config to have

  <add key="TempPackage" value="https://pkgs.dev.azure.com/mycompany/myproject/_packaging/myfeed/nuget/v3/index.json" />

Now it works!

解决方案

In Azure Devops web portal, for your current project, go Artifacts tab and make sure your packages like mypackagetemp.nupkg are available there.

For me, I have custom LibraryCore.nupkg pushed there. Now let's click the Connect to feed settings, choose nuget.exe and you can see:

Copy exactly same content to your own mynuget.config file. Then your build pipeline can access your published mypackagetemp.nupkg.

Failed to retrieve information about 'Serilog.Enrichers.Thread' from remote source 'https://pkgs.dev.azure.com/mycompany/_packaging/myfeed/nuget/FindPackagesById()?id="Serilog.Enrichers.Thread'', response status code does not indicate success: 404 (Not Found).)

The next time I built I got a different error looking for WindowsAzure.Storage

These packages(Serilog.Enrichers.Thread,WindowsAzure.Storage and ...) are all available in nuget.org, so you should also make sure you've add nuget.org as package source in your config file:

In addition:

According to your description, you only need to use your custom devops feed and other packages from nuget.org, apart from using your mynuget.config, you could configure your nuget restore task like this:

Choose devops feed directly(second red line) by Feeds I select here instead of Feeds in my Nuget.config. And check the Use packages from nuget.org checkbox. Then you can access the packages in custom feed and nuget.org during build.

这篇关于从副本发布nuget包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆