You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On my machine it always fails with:
error NU1004: The packages lock file is inconsistent with the project dependencies so restore can't be run in locked mode. Please disable RestoreLockedMode MSBuild property or pass explicit --force-evaluate flag to run restore to update the lock file.
Steps to reproduce
$nugetconfig = @"
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
"@
$dirprops = @"
<Project>
<PropertyGroup>
<!--NUGET RESTORE SETTINGS -->
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<!--NUGET RESTORE SETTINGS -->
</PropertyGroup>
</Project>
"@
mkdir test
cd test
mkdir ".nuget"
$nugetconfig | Out-File ".nuget\nuget.config"
$dirprops | Out-File "Directory.Build.props"
dotnet new sln
mkdir Fabric.Classlib
mkdir Fabric.Base.ClassLib
cd Fabric.Classlib
dotnet new classlib
cd ..
cd Fabric.Base.Classlib
dotnet new classlib
cd ..
cd Fabric.Classlib
dotnet add reference ..\Fabric.Base.Classlib\Fabric.Base.Classlib.csproj
cd ..
dotnet sln add Fabric.Base.Classlib\Fabric.Base.Classlib.csproj
dotnet sln add Fabric.Classlib\Fabric.Classlib.csproj
msbuild test.sln /t:restore
msbuild test.sln /t:restore /p:RestoreLockedMode=true
Expected behavior
msbuild test.sln /t:restore /p:RestoreLockedMode=true should succeed.
Actual behavior
Fails with the below error.
error NU1004: The packages lock file is inconsistent with the project dependencies so restore can't be run in locked mode. Please disable RestoreLockedMode MSBuild property or pass explicit --force-evaluate flag to run restore to update the lock file. [C:\Temp\test\test\test.sln]
Environment data
msbuild /version output:
C:\Temp\test\test>msbuild /version
Microsoft (R) Build Engine version 16.1.76+g14b0a930a7 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
16.1.76.45076
OS info:
Windows 10 1903
If applicable, version of the tool that invokes MSBuild (Visual Studio, dotnet CLI, etc):
From @jabbera on Thursday, June 20, 2019 3:51:25 PM
I would expect the following to always succeed.
On my machine it always fails with:
error NU1004: The packages lock file is inconsistent with the project dependencies so restore can't be run in locked mode. Please disable RestoreLockedMode MSBuild property or pass explicit --force-evaluate flag to run restore to update the lock file.
Steps to reproduce
Expected behavior
msbuild test.sln /t:restore /p:RestoreLockedMode=true should succeed.
Actual behavior
Fails with the below error.
error NU1004: The packages lock file is inconsistent with the project dependencies so restore can't be run in locked mode. Please disable RestoreLockedMode MSBuild property or pass explicit --force-evaluate flag to run restore to update the lock file. [C:\Temp\test\test\test.sln]
Environment data
msbuild /version
output:OS info:
Windows 10 1903
If applicable, version of the tool that invokes MSBuild (Visual Studio, dotnet CLI, etc):
Copied from original issue: dotnet/msbuild#4455
The text was updated successfully, but these errors were encountered: