NuGet packageSources priority

老子叫甜甜 提交于 2020-08-02 07:55:59

问题


If you have multiple packageSources in your NuGet.config:

<packageSources>
  <clear />
  <add key="dev" value="http://server2/branches/feature1/nuget" />
  <add key="release" value="http://server1/nuget" />
</packageSources>

Is the order in the XML used when running nuget install, etc? If I have packageA at version 1.0.0-SNAPSHOT in both, will the dev channel version on feature1 branch win?


回答1:


The order of your feeds in nuget.config determines the order that they show up in the drop down menus from the various views into NuGet from Visual Studio. In all cases, you have the choice of which feed you install from. See the screenshots below.

Visual Studio doesn't keep track of where your package came from, so the package ID is really in a global namespace that you have to know which feed it's a part of. Visual Studio will show you any package from the selected feed with a matching ID, so it's possible that you'd overwrite a package you installed from one feed with another from a different feed.

For a NuGet feed that I manage at my company, I prefix our internal packages with <CompanyName>. so as to reduce the risk for a naming conflict now and in the future.



来源:https://stackoverflow.com/questions/36470532/nuget-packagesources-priority

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!