Scenario: We wanted to move some code over to a new repo (NewSln), so we created that new repo, and then added the code back as a submodule in the original repo (OldSln). Had to modify a few references to point to the new version, but was able to get the build to work locally.
Issue: After doing this, the Azure Devops build failed on the msbuild building step due to
Error : This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105
The missing file is ..\..\..\packages\Fody.6.5.2\build\Fody.targets
. and other similar issues. We had not made any changes to those references
I noticed that the restore step was restoring the packages to the submodule directory. For example, I saw this line
2022-02-10T23:52:45.1474898Z Adding package 'AcisExtensionSDK.1.0.4.1061' to folder 'C:__w\1\s\NewSln\packages'
I confirmed that this submodule is only used by the larger repo and not the submodule, yet it is being restored to \NewSln\packages\
rather than \packages\
Debugging effort so far: I can see the references that are showing up as missing on the build locally, and the build is working locally, with nothing obvious to me as why it fails on dev ops. I also see various stack overflow posts about the opposite issue, where the nuget restore doesn't import the references for the submodule repo, but I found nothing for the case where only the submodule repo is restored.
Is there anything that could cause this and what would be the way to route the packages being restored back to the appropriate package?