Interesting error in Visual Studio when trying to build a project
CSC : error CS0006: Metadata file '<project_path>\packages\Microsoft.IdentityModel.7.0.0\lib\net35\microsoft.identitymodel.dll' could not be found
This was repeated for every referenced dll in each project in the VS solution.
The problem turned out to be a problem in the solution folder name. The folder name had a space in the name, but when cloned from AzureDevOps the cloned folder name used the html encoded version of the name to create the file system folder, putting %20 in place of the space.
In the build errors the name has the space rendered correctly in the output log, however going into the console and trying a dotnet restore
command gave error messages that showed the paths that the command was actually looking for
C:\Program Files\dotnet\sdk\5.0.407\NuGet.targets(290,5): error MSB3202: The project file "C:\Users\bob\source\repos\My Project\Test\Test.csproj" was not found. [C:\Users\bob\source\repos\My%20Project\Test.sln]
So after much head scratching the fix was simple, close Visual Studio and rename the solution folder to replace %20 with a space.