Virtual File System Sample for Mac in .NET, C#

In this article

Virtual File System Sample for Mac in .NET, C#

This sample implements a virtual file system for Mac with synchronization support and folders on-demand listing. It synchronizes files and folders both from remote storage to the user file system and from the user file system to remote storage. This sample is written in Xamarin, .NET/C#. To simulate the remote storage, this sample is using a folder in the local file system on the same machine. 

The purpose of this sample is to demonstrate the major features of the IT Hit User File System for .NET on macOS and provide patterns for its programming. You will use this sample as a starting point for creating a OneDrive-like file system for macOS for your DMS/CRM/ERP and will reprogram it to publish data from your real storage instead of the local file system.

You can download this sample and a trial license in the product download area. You can also clone it and browse the code on GitHub


  • macOS 11.0+
  • Mono
  • Xamarin.Mac:
  • Xcode 12.4+
  • Visual Studio Community 2019 for Mac v8.8.10+, Stable Channel.

Solution Structure

The macOS sample solution consists of 3 projects: container application, an extension project, and a common code.

The container application provides a Menu Bar icon to install/uninstall the file system extension. Inside the container application, you should change the hardcoded directory to replicate in your Virtual Disk manually. Consider that the extension can only access sandbox folders (including Downloads, Pictures, Music, Movies). It means that it won't be able to show the contents of the folder outside of the sandbox.

The extension project runs in the background and implements a virtual file system on macOS (File Provider). It processes requests from macOS applications sent via macOS file system API and lists folders content. The macOS extension can be installed only as part of a container application, you can not install the extension application by itself.

Configuring the Sample

In the following steps, we will describe how to configure and run this sample in the development environment. You will create an Apple group ID, Apple app identifies, and Apple provisioning profiles. Then you will update the sample container application project and extension project to use the created IDs and profiles.

Log-in to the Apple developer account here: To complete the steps below you must have an App Manager role.

  1. Create App Group. Navigate to Certificates, IDs, Profiles -> Identifiers -> App Groups and create a new group.

  2. Create Apple macOS App IDs. Navigate to Certificates, IDs, Profile -> Identifiers -> App IDs. Create 2 identifiers that will be unique for your project. One will be used for container application another – for the extension.

  3. Add app identifiers to the group. Add both identifiers created in Step 2 to the group created in Step 1. Select identifier and click on Edit. Then check the App Groups checkbox, select the Edit button and select the group created in Step 1.

  4. Create Provisioning Profiles. Navigate to Certificates, Identifiers & Profiles -> Profiles -> Development and create profile. Associate profile with extension ID and container ID respectively.

  5. Download profiles and certificates in XCode. Run XCode and go to Xcode Menu > Preferences -> Accounts tab. Select team and click on “Download Manual Profiles”. You can find more detailed instructions: here

  6. Set bundle identifier name in Container project. The bundle identifier is located in VirtualFilesystemMacApp/Info.plist file. You can edit it either in Visual Studio or directly in Info.plist file in the CFBundleIdentifier field (by default it is set to You must set this identifier to the value specified in Step 1.

  7. Set bundle identifier name in the Extension project. The bundle identifier is located in FileProviderExtension/Info.plist file. You can edit it either in Visual Studio or directly in Info.plist file in the CFBundleIdentifier field (by default it is set to You must set this identifier to the value specified in Step 1.

  8. Configure macOS bundle signing in Container and Extension projects. For each project in Visual Studio go to the project Options. Select Mac Signing and check 'Sign the application bundle'. Select Identity and Provisioning profile.

  9. Configure application permissions in Container and Extension projects. Select Entitlements.plist and select group created in Step 1 in App Groups field for each project.

  10. Set App Group ID in code. Edit AppGroupsSettings.cs file located in /VirtualFilesystemCommon/ folder. Specify AppGroupId.

  11. Set the license. Download the license file here. With the trial license, the product is fully functional and does not have any limitations. As soon as the trial license expires the product will stop working. Open the VirtualFilesystemMacApp/Resources/appsettings.json file and set the License string: 

    "License": "<?xml version='1.0'...",
  12. Set the remote storage directory. Here you must set the path to the folder that simulates your remote storage. Your virtual drive will mirror files and folders from this folder. Note that the extension runs as a sandboxed application and has access to a limited number of locations in the local file system. To simulate the remote storage structure you can copy the \RemoteStorage\ folder provided with the project under the ~/Pictures/ folder. To set the remote storage directory open the VirtualFilesystemMacApp/Resources/appsettings.json file and set RemoteStorageRootPath string. Make sure to replace the ${USER} with a real user name:

    "RemoteStorageRootPath": "/Users/User1/Pictures/RemoteStorage"

Now you are ready to compile and run the project.

Running the Sample

To run the sample open the project in Visual Studio and run the project. The application adds an application to the macOS Status Bar. To mount the file system select the 'Install Extension' command in the Status Bar.

Virtual File System Mac in .NET/C#

Note, that every File Provider Extension runs in a sandbox, so access to the local filesystem restricted by OS except Downloads, Pictures, Music, Movies public directories.

Next Article:

Virtual Drive Sample in .NET, C#