Forum Xamarin.iOS

What is causing this build error targeting iphonesimulator?

blmilesblmiles Member ✭✭
edited March 2020 in Xamarin.iOS


I'm getting these errors, building for any iOS simulator:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(473,3): error MSB3231: Unable to remove directory "obj\iPhoneSimulator\Debug\". The directory is not empty


SeverityCodeDescriptionProjectFileLineSuppression StateSuppression State Error Unable to remove directory "UserControls". Access to the path 'D:\Projects\Solutions\mycompany\iOS\obj\iPhoneSimulator\Debug\UserControls' is denied.mycompany.iOS

OR both together...

I'm using VS 2019 version 16.3.7 on Windows 10 machine and Xcode 11.2.1 on Mac Mini, OSX 10.14.6 and it does not matter which iOS simulator targeted, all version 13.2.2. Developing a Xamarin Forms application.

If I switch to target one of my hard devices, I get multiple errors like this:
error : Access to the path 'D:\Projects\Solutions\mycompany\iOS\obj\iPhone\Debug\Popups\TemplatePicker.xaml.g.cs' is denied.
I can work around this by quitting VS, removing read-only flag on the obj folder and all it contents, run VS as admin, THEN it builds and pushes to the device.

Switching back to target a simulator, I get the first error again.

Deleting Bin and Obj folders does not help either.

Side note - this was working until Windows rebooted itself on my dev machine, closing VS and forcing recovery of some files. Android version works just fine in simulator and hard device, no issues.

Wondering if I upgrade VS to version 16.4.5 and Xcode to 11.3.1, this might be resolved. Any ideas?
Are these version compatible with the latest VS-Xcode connector? (I've seen issues with version incompatibility) .

Any ideas? Resolutions?

Thank you


  • LandLuLandLu Member, Xamarin Team Xamurai

    I'm using the latest version of Visual Studio and XCode.
    It works fine on my side. And the attribute of the folders is read-only.
    Maybe the environment of the VS has been broken, try to update them both on Windows and Mac.

Sign In or Register to comment.