I started seeing this error while setting up my Azure DevOps build pipeline to run under different environments. And I found a lot of posts about it while searching for the cause of the issue.
Quite a few mentioned that the Xaml had an error causing the issue. But I could build the app fine with no errors, including using the environment setting used by the build pipeline that threw the error.
When I looked in the iOS csproj file, I found that I had several UAT configuration entries duplicated. I suspect this is from when I was originally getting the environments set up on the project. I’m not sure why Visual Studio duplicated them but cleaning this up solved the issue.