Nuget - Packages.Config using latest versions of packages

Asked

Viewed 158 times

2

Setting

I have a project where my Libraries (other components of the project) are Nuget packages, and whenever there is an update, a new version is generated in Proget.. and all developers have to update Packages manually so that Teamcity for example uses the latest version specified in package.config.

Following is a simplified example of my file Packages.config

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="BibliotecaX" version="2.0.1" targetFramework="net461" />
</packages>

I would like to do it in a way where instead of specifying this version, use the version for example version="2.0.*" or version="2.*.*" for when Visualstudio will make Store always get the latest version (only of specific packages) where I would make this configuration.

If anyone has any suggestions.

  • What version of the nuget?

  • Nuget Version: 4.5.1.4879 I am trying to bypass doing in Prebuild Events and calling the command this way: nuget update project.csproj -Id Pacotenuget

  • Tried to leave the version number empty?

  • <package id="BibliotecaX" version="" targetFramework="net461" />

  • Invalid package version for package id 'Newtonsoft.Json': '10.0. ' tried with space too, it ignores and does not work

  • 1

    As far as I know, what you are trying to do does not work, every package has to have its version, it is beyond the final versions (release) has the beta versions, IE, the file has to identify what you need ... !!! I even researched, for free, because I create packages not have it or not found.

  • @LINQ did not work, unfortunately

  • 1

    @Virgilionovic the way will be to do manually in the prebuild with the commands nuget same and update, ta working out here I am testing, if I manage to successfully put here detailed answer. Thanks for the help

Show 3 more comments

1 answer

1


I have resolved as follows: I converted the Packages.config for packagereferences

I used this Xtension to help me migrate:

https://marketplace.visualstudio.com/items?itemName=CloudNimble.NuGetPackageReferenceUpgrader

Having done this, within Csproj I did it as follows: (the name of the components are just examples)

  <ItemGroup>
    <PackageReference Include="Castle.Core" Version="4.2.*" />
    <PackageReference Include="Newtonsoft.Json" Version="10.0.*" />
    <PackageReference Include="NSubstitute" Version="3.1.*" />
   </ItemGroup>

Solved, in the build it downloads the latest version according to my condition (1.0.*)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.