简体   繁体   中英

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?

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

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

在此处输入图像描述

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM