Visual Studio Code For Ios

  
  1. Cisco IOS Syntax Highlighting for Visual Studio Code. Install the extension with VSCode. Save a file with the.ios extension and open with VSCode. Visual Studio Marketplace.
  2. Visual Studio Code is free and available on your favorite platform - Linux, macOS, and Windows. Download Visual Studio Code to experience a redefined code editor, optimized for building and debugging modern web and cloud applications.
  1. Visual Studio Code For Ios Development
  2. Visual Studio Code Ios Emulator
  3. Visual Studio Code For Ios

Xamarin Remote iOS Simulator is a wonderful tool to be able to develop iOS solely on your windows desktop with Visual Studio and just have a network access to a Mac system.

Visual studio code for ios

Visual Studio Code For Ios Development

While it was available for any Xamarin edition (even Community) during the preview, the simulator is now in a release state and available only for people with Enterprise licence which means nearly no one except people working in Fortune 500 companies.

Code

If you want to get IOS Simulator in VS Code, install Xcode and open it, then go to Preference Location and there you will see Command Line Tool. Just click the drop-down button and save something like Xcode 11 (Version) and save it. Also, I recommend getting IOS and Andriod Simulator in VS Code.

But, since it works very well for the preview, why couldn’t we use it now ? The only reason: money ! That’s a pretty good reason for Xamarin/Microsoft but not for me.

Below you will find a method to be able to remove this limitation. This has only been tested on VS Pro but should work on VS Community too.

If you only want to be able to use it and not to understand the How, just go to the section Install modified version

Lets change this behavior

While the Remote iOS Simulator was in preview, it was available in the options as a checkbox in the iOS settings. Once Xamarin extension has been updated, this checkbox is only available for VS Enterprise edition. We need to get this checkbox back !

Xamarin is installed as an extension so all of its features are in the code in the extension. The extension is installed in C:Program Files (x86)Microsoft Visual Studio 14.0Common7IDEExtensionsXamarinXamarin, you could have multiple version available, pick the last one, previous ones are remainings of update process. In the extension directory, you can find many dlls

First we need to find the one which is controlling iOS deploy and settings. After some digging around, I found it’s Xamarin.VisualStudio.IOS.dll (kind of obvious no ?). Thanks to the wonderful dotPeek tool, I found two classes which check the Visual Studio edition :

  • The ReadSettings method in MonoTouchSettingsDialog (in namespace Xamarin.VisualStudio.IOS.Dialogs). This method show or hide the checkbox in the iOS settings.
  • The ResolveSimulatorLauncher method in MonoTouchDevice (in namespace Xamarin.VisualStudio.IOS). This method choose between iOS Remote Simulator and the Simulator on Mac when you want to launch your app on a Simulator

Visual Studio Code Ios Emulator

Both of those method check if the current edition of VS is equal to 3, this is the value of an enum (Undefined = 0, Community = 1, Pro = 2, Enterprise = 3). Since the value is always less than 3, we gonna edit the dll to change the comparison to currentEdition < 7. Why 7 ? Because it’s a cool number greater than 3 and it’s available as a one byte IL instruction just like 3 (instruction ldc.i4.3 )

Now the difficulty is the dll is stronly named and so cannot be decompiled, modified and recompiled, VS will not load it in this case. But our solution will be to edit the dll directly in hex format. For this, we need to have an hex editor (I choose HxD) and be able to find the correct bytes to edit in the dll. We will use ildasm to show the dll content in a “readable” format and just have to find the correct sequence of byte in the dll.

First, launch ildasm and open the dll (copy it to a different location before where you will not be bother with admin privileges). Ildasm is available in the Visual Studio Developer command prompt.
In Ildasm use the View menu to enable the “show bytes” option.
Now you can open the first method ReadSettings in MonoTouchSettingsDialog. Scroll down a little and you will found something like the image above (circled in red)

List of IL instructions
Those two instructions do the following thing, add 3 to the stack, then check if both value on the top of the stack are equals. We need to replace them with “add 7 to the stack”, “check if second value on the stack is lower than first (our 7)”.
Instruction to do that are ldc.i4.7 (hex code: 0x1D) and clt (hex code 0xFE 0x04).

Open another copy of the dll into the hex editor, and we will need to find the correct sequence of bytes. The left part of hex code in the image above (in blue) are the instructions code and black part is arguments. The black parts need to be reversed when trying to find them in the dll code because it’s little endian encoded. So for the first argument sequence 0A000114, we will search 1401000A. In this case we will search the sequence 6F1401000A28FB03000A19FE01, there should be only one in the file, if more than one are found, just add some other bytes to the search. Now we will edit the 19 FE 01 part and replace by 1D FE 04. If you save this modification and open the modified dll in dotPeek or any good c# decompiler, you can check that the modification is good and now the edition is checked as lower than 7.

For the second method, the il file is available in the image below :

Code

So look for sequence 6FFB00000628FB03000A19332B and turn the 19 33 into 1D 35. Save the file, and copy it back to the extension directory (keep a backup of the original file in case of trouble). You can now launch Visual Studio and launch your app in the remote iOS simulator.

Install an already modified version

Visual Studio Code For Ios

You need to download the Xamarin.VisualStudio.IOS.dll which corresponds to your Xamarin extension version.
To do this, check directory : C:Program Files (x86)Microsoft Visual Studio 14.0Common7IDEExtensionsXamarinXamarin and pick the last version.

Modified versions :
– 4.2.2.11 : Xamarin.VisualStudio.IOS.dll
– 4.4.0.34 : Xamarin.VisualStudio.IOS.dll (check the updated post for this version)

Code

You didn’t found the version you expected, you can contact me and I will do it as fast as I can 🙂

Visual

Visual Studio must be closed before doing this !

Once you downloaded the file corresponding to your extension version, just rename it “Xamarin.VisualStudio.IOS.dll” and replace the one in the extension directory. (You can make a copy of the origin just in case of trouble with the new one).

And now, you can restart Visual Studio and in Tools->Options->Xamarin->iOS Settings, you will have the “Remote Simulator to Windows” checkbox available ! Check it and you should be able to run the remote simulator for an iOS app. (Do not forget to install the remote simulator first).

Hope you have found this post useful ! Do not hesitate to drop a comment to show your support.