2
votes

I want to use the Locking dependencies of Nuget (>= 4.9), so I can have automatic package update during dev phase and fixed version during release build.

I enabled the lock file mode, so I now have a packages.lock.json file.

The problem is that when I have floating version of package references in the project file like:

<PackageReference Include="My.Nuget.Package" Version="1.0.*" />

The restore package via Visual Studio Build does not update to new packages version anymore. This behavior appeared after I activated the lock file.

The Microsoft documentation describes the --force-evaluate option with dotnet.exe, that works well but I want to do this directly with an MsBuild option in the csproj.

By checking the NuGet Client code, it seems that a RestoreForceEvaluate option exists in Msbuild NuGet.targets but I have no idea how to use it.

1

1 Answers

3
votes

By checking the NuGet Client code, it seems that a RestoreForceEvaluate option exists in Msbuild NuGet.targets but I have no idea how to use it.

I am afraid we could not do that at this moment. According to the nuget wiki,

Enable repeatable package restore using lock file:

enter image description here

There is no such MSBuild equivalent option for option --force-evaluate, so we could not use --force-evaluate directly with an MsBuild option in the csproj.

Hope this helps.