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

问题描述

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

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

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

我想发布到临时供稿.

我阅读了

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

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

When I repeat the command I get a request for credentialsWhen 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

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

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

[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.

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包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 03:55
查看更多