Reputation: 1060
I am trying to get file from PCL
project using PCLStorage
as below. I am using Xamarin in Visual Studio 2015 Professional.
IFile file = await FileSystem.Current.GetFileFromPathAsync("file\path");
But I am getting exception as:
System.NotImplementedException: This functionality is not implemented in the portable version of this assembly. You should reference the PCLStorage NuGet package from your main application project in order to reference the platform-specific implementation.
Upvotes: 3
Views: 1214
Reputation: 24460
You need to add the PCLStorage NuGet to both your PCL and your platform specific project.
So if you have the following solution:
PCL
Android
iOS
You would need to add it to all of them:
PCL
PCLStorage
Android
PCLStorage
iOS
PCLStorage
Why? Because the NuGet uses the bait and switch technique, where the PCL contains a simple facade with the bait. At runtime this gets switched out with platform specific implementation.
Upvotes: 5