3
votes

I am trying to install System.ComponentModel.Annotations through VS 2017 package manager console.

Command:

Install-Package System.ComponentModel.Annotations -Version 4.3.0

Outcome

Restoring packages for C:\MyTest.csproj... Installing NuGet package System.ComponentModel.Annotations 4.3.0. Committing restore... Writing lock file to disk. Path: C:\MyTest\obj\project.assets.json Restore completed in 816.43 ms for C:\MyTest.csproj. Restoring packages for C:\MyTest.csproj... Committing restore... Lock file has not changed. Skipping lock file write. Path: C:\MyTest\obj\project.assets.json Restore completed in 2.03 sec for C:\MyTest.csproj. Executing nuget actions took 4.12 sec Time Elapsed: 00:00:05.2258592

Note:

I am using .NETCoreApp1.1 framework.

2
How did you know that the package was unable to be installed? I also got the same outcome in the output windows when I restore/update that package, but I found that package was already installed to the project after checking the project Dependencies and project file(.csproj). And the outcome did not tell the installation failed, just prompting skip lock file write, so you should double check if that package is installed. if not, please give us more info or some screenshots.Leo Liu-MSFT
what about this issue? Would you please let me know the latest information about this issue?Leo Liu-MSFT
@Leo-MSFT, You are absoutely correct. This message comes only if that package was already installed to the project. It took me a while to understand this issue and off course with the help of your comments. Thanksimmirza
I have convert my comment to the answer, you can mark it as answer, so that we could closed this thread and It is also benifit to other communities has the same issue, easier to find the answer. Thanks.Leo Liu-MSFT

2 Answers

3
votes

Unable to install package. Lock file has not changed, Skipping lock file write

I also got the same outcome in the output windows when I restore/update that package, but I found that package was already installed to the project after checking the project Dependencies and project file(.csproj). And the outcome did not tell the installation failed, just prompting skip lock file write:

Restoring packages for C:\MyTest.csproj... Committing restore... Lock file has not changed. Skipping lock file write.

So this message comes only if that package was already installed to the project. When you got that log, you should double check the project reference, make sure if the package already installed.

0
votes

One should also check if there is a Directory.Build.targets file in some parent directory of the project that defines the version of the package. If this is the case (I had this problem), VS will ignore the version you install and will keep the version defined in the file, so you have to update the version there.