2
votes

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.

2
Set "Default package management format" in options to "PackageReference". Create new project. See what's the difference or even, just replace old proj file with the new one, add files, if this is FW stype projectT.S.

2 Answers

8
votes

Am I safe to remove it and ignore the warning?

This could be an BLC 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.

1
votes

Remove your package folder and build the solution. It worked for me.