Error when working on project from windows 10 laptop

SwissSwiss Member ✭✭

Good morning, I have a rather large project that I've been working on without any problems on my mac desktop, but I'm having a problem preventing me from building anything when I attempt to work on the project from a windows machine.

My shared project contains code like
` if(Device.RuntimePlatform == Device.iOS)
{

            // Create base Alert Controller
            UIAlertController alertController = UIAlertController.Create("", null, UIAlertControllerStyle.Alert);

...`

Which needs a reference to Xamarin.iOS, but when attempting to add that reference under a clean install, I get an error "'CSHarpAddImportCodeFixProvider' has encountered an error and has been disabled"
System.AggregateException : One or more errors occurred. ---> Unable to find a type of reference that is appropriate for this file: "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\Xamarin.iOS\v1.0\Xamarin.iOS.dll".

Anyone come across this before?

Answers

  • MaxymMigrinMaxymMigrin USMember ✭✭
    edited July 2018

    Did you setup a connection to your Mac in VisualStudio solution?
    You should have to setup connection to Mac with Xamarin Studio installed and Xamarin Mac Agent running. Visual Studio running on Windows can't work with iOS projects without that.

  • SwissSwiss Member ✭✭

    Yes, this is while connected to my osx desktop.
    I found a workaround by replacing those statements with #if IOS #endif #if__ANDROID__ #endif, and then removing the IOS macro from the args, which causes the statement to act as a comment, and allows me to work on and build the android app on my PC, while ignoring the iOS specific code.

    Not sure if it's exactly a smart method, but no problems so far.

Sign In or Register to comment.