NWard is absolutely right. Not sure about the code you're trying to use to add the references but the csproj file in the project root can be edited programmatically to add the following in its rightful place:
<ItemGroup>
<ProjectReference Include="..\MyOtherProj\MyOtherProj.csproj">
<Project>{abda85bb-2019-4b80-982e-b90add3fcca0}</Project>
<Name>MyOtherProj</Name>
</ProjectReference>
</ItemGroup>
Call an internally invoked powershell script or some console exe. Hope this helps!