Xamarin.iOS Build issue - Root Assembly Conflict

The Issue here is with the root assembly conflicts with another assembly

The environment I have here is a MacBook Pro 15 with most recent macOS and Visual Studio for MAC (latest version). Along with this mac setup I have a Windows 10 instance with Visual Studio 2017 (most recent version).

I have created a template Xamarin Forms Project (PCL) with Android and iOS projects.

Building the iOS project gave me the following error (obv: my visual studio instance is connected to my mac using the mac agent)



The root assembly /Users/vijayamalla/Library/Caches/Xamarin/mtbs/builds/iOSProjectName.iOS/ac16c487311abbbeafd486f50700030e/bin/iPhoneSimulator/Debug/iOSProjectName.exe conflicts with another assembly (/Users/vijayamalla/Library/Caches/Xamarin/mtbs/builds/iOSProjectName.iOS/ac16c487311abbbeafd486f50700030e/bin/iPhoneSimulator/Debug/iOSProjectName.exe).

I have looked around to resolve this error, trying to get my head around since I have all the latest versions of softwares installed.

I have stumbled upon this link

https://forums.xamarin.com/discussion/92773/the-root-assembly-conflicts-with-another-assembly

I have tried the solution suggested above, to make it easy I did the following steps

  1. Open Xamarin.iOS.Common.After.targets file here; C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\iOS

  2. Made a backup of this file and updated one of the files with Notepad ++ (as an administrator)

  3. Made the following changes

    line 73:

    remove: <ReferencedDlls Include="@(AllBuiltProjectOutputs);" />

    remove: <
    Assemblies Include="@(MainAssembly);@(ReferencedDlls)" />

    add: <
    Assemblies Include="@(AllBuiltProjectOutputs)" />

    line 85:

    remove: < MTouchReferencePath Include="@(Assemblies)" />

    add: < !-- Don't append as an MTouchReferencePath the primary assembly itself since that's already passed as MainAssembly="$(TargetPath)" -->

    add: < MTouchReferencePath Include="@(
    Assemblies)"

    Condition="'%(_Assemblies.IsKeyOutput)' != 'true'" />

  4. Save and now Rebuild

  5. DONE

and now with the wonderful iOS Simulator on Windows from Microsoft, we can see it work just fine.

Thank you

Vijaya Malla

@vijayamalla