Posted by & filed under Developer Blog.

If you want to develop using Sublime Text (or other) on Mac but your company uses ASP.NET MVC for back-end server, this information may be helpful to get you to where you can have a shared drive in from Mac to a VM. Build using Visual Studio in the VM, but develop using the Mac.

These instructions are Parallels specific, but should be very similar for other VM hosts.

Set up a static ip address on your Virtual Machine

  1. In Windows, go to Control Panel > Network and Internet > Network and Sharing Center
  2. Click “Ethernet” under the active networks section.
  3. Click the “Properties” button.
  4. Scroll down and highlight “Internet Protocol Version 4 (TCP/IPV 4)”
  5. Click the “Properties” button
  6. Select the “Use the following IP address:” option and use the following (exactly)
    • IP Address: 10.211.55.3
    • Subnet Mask: 255.255.255.0
    • Default Gateway: 10.211.55.1
    • Preferred DNS Server: 10.211.55.1
    • Alternate DNS Server: (leave this one blank)

Add to hosts

On your Mac, edit /etc/hosts file

Add the following line, with your VM guest IP address from the previous step:

10.211.55.3 localhost

Install IIS on Windows

This has been documented a thousand places. I followed these instructions

Enable .NET

  1. Type appwiz.cpl into Run (WIN +R)
  2. On the left hand side click on the “Turn Windows features on or off” link.
  3. Now expand Internet Information Services > World Wide Web Services > Application Development Features.
  4. Place a check next to ASP.NET 4.6 (or your version) which will also check 3 other boxes.
  5. Click OK.

Install URL Rewrite 2.0

  1. Download and install the Web Platform Installer on Windows
  2. Once it instals and opens, search for URL Rewrite 2.0
  3. Click the Add button
  4. Down below, click the Install button
  5. Accept the terms

Enable Network Sharing

Windows 8:

  1. Open File Explorer
  2. Click the Network shortcut on the left column
  3. When prompted click the little yellow bar at top “Click to change”
  4. Select “Turn on network discovery and file sharing”
  5. Select the “No” option.

Windows 10:

  1. Settings > Network & Internet > Ethernet
  2. Click the blue Network Icon (Network Connected) under the Ethernet title
  3. Turn the switch to on.
  4. Restart

Configure your web server

  1. In IIS Manager, go to your Default Web Site under Sites.
  2. Click Basic Settings from the column on the right.
    • Select the DefaultAppPool.
    • Point the Physical Path your Web project folder. (something like \\Mac\Share\repo\Project.Web)
    • Click OK

Turn off Private Network firewall

  1. In Windows 8: Go to Control Panel > System and Security > Windows Firewall > Turn Windows Firewall on or off. In Windows 10: Go to Settings > Network and Internet > Ethernet (left tab) > Windows Firewall > Turn Windows Firewall on or off.
  2. Under Private network settings, choose to Turn off Windows Firewall
  3. Click OK.

Build

Build the code in Visual Studio

Test

  1. test to see if you can access the content from within the Virtual Machine
  2. If that works, try it from your Mac

Viewing Changes

  1. Any server code (C#, .NET, Razor) changes made to the app will require the DefaultAppPool to be Recycled before they will appear in your browser on the mac.
  2. Fire up IIS Manager by typing inetmgr into Run (WIN + R)
  3. Select Application Pools > DefaultAppPool
  4. Choose Recycle in the right column (note: recycle happens very fast)
  5. Refresh the browser (this usually takes a moment or two after a recycle)

Troubleshooting

  1. Build Clean Solution
  2. Build Rebuild Solution
  3. Restart the app pool
  4. Make sure your mapped drive > repo directory isn’t marked as read only
    • right click your repo directory > properties
    • if read only is marked, uncheck it and apply to all sub-folders and files.