Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Solution uses PackageReference, but getting compile error referencing packages.config

My solution has two projects - proj1 and proj2, which references proj1. I just converted the solution from packages.config to PackageReference, now when I build the solution, proj2 fails to compile with error:

Could not locate C:\Users...\source\repos\project\proj1\packages.config. Ensure that this project has Microsoft.Bcl.Build installed and packages.config is located next to the project file

I looked at the .csproj files, and there are zero references to any packages folder.

If I remove the nuget package Microsoft.Bcl.Build from proj2, it compiles successfully but I get a warning saying any project that references proj1 must install that package.

Am I safe to remove it and ignore the warning? Otherwise i'm not sure why it's referencing packages.config file when i'm using PackageReference.

This is on latest VS 2019.

like image 846
Greg Avatar asked Apr 15 '26 00:04

Greg


1 Answers

Am I safe to remove it and ignore the warning?

This could be an BCL nuget package issue(last update 2014). The package itself checks packages.config by mistake. If you use the new PackageReference(comes after VS2017) package management format, this error will happen.

So if your projects don't depend on that package, you can feel free to remove them all. Also you can try to suppress the warning by adding <SkipValidatePackageReferences>true</SkipValidatePackageReferences> to top of the xx.csproj file. Hint from this issue.

like image 108
LoLance Avatar answered Apr 18 '26 10:04

LoLance