Homayoun Behzadian
Homayoun Behzadian

Reputation: 1163

How to force Visual Studio to check for latest version of floating point nuget dependencies

I'm using floating point dependencies for my other projects like below:

<PackageReference Include="Farayan.NETCommonSuper" Version="1.0.*" />

Version 1.0.* means latest version of Farayan.NETCommonSuper that starts with 1.0., but visual studio does not check for latest version on every build.

Imagine I updated module Farayan.NETCommonSuper that I need to get reflected into my another module (let's name it depend module), currently I need to open Manage nuget packages context menu, and update dependency by myself, which removes * version and fix it in .csproj file, then open that .csproj file to revert it back.

Is there any settings or config or script to force vs to check for latest version of a star-versioned dependency?

Upvotes: 4

Views: 2056

Answers (2)

Mr Qian
Mr Qian

Reputation: 23808

I agree with zivkan. However, VS IDE detects the float version of the nuget dependency automatically.

To add more detail

Version 1.0.* means latest version of Farayan.NETCommonSuper that starts with 1.0., but visual studio does not check for latest version on every build.

Please if you have enabled the two options under Tools-->Options

enter image description here

Also, you could try this to make a automatic script:

Right-click on your project on the Solution Explorer-->Properties-->Build Event-->

add like this this under Pre-build event command line:

"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe" -t:restore -p:RestoreForceEvaluate=true

Click Build button and you can get that you want.

Upvotes: 0

zivkan
zivkan

Reputation: 15071

Visual Studio

Right click the solution in Solution Explorer, and select "Restore NuGet Packages"

dotnet CLI

dotnet restore --force-evaluate

msbuild

msbuild -t:restore -p:RestoreForceEvaluate=true

nuget.exe

nuget.exe restore -ForceEvaluate

Upvotes: 3

Related Questions