Forum Cross Platform with Xamarin

Unable to load file using PCL Storage in PCL project

I am trying to get file which is added in PCL project as below:

   IFile file = await PCLStorage.FileSystem.Current.GetFileFromPathAsync("ProjectName.Data.AuthRequest.json");

Above is always returning null. BuildAction is set to Embedded Resource


  • JamesMontemagnoJamesMontemagno USForum Administrator, Xamarin Team, Developer Group Leader Xamurai

    You most likely need the embedded resource plugin:

    PCL Storage is for File IO

  • Without using any plugin, following code working fine.

        var assem = typeof(Class).GetTypeInfo().Assembly;
                        Stream stream = assem.GetManifestResourceStream(string.Format("ProjectName.CustomFolder.FileName"));
                        using (var reader = new System.IO.StreamReader(stream))
                            text = reader.ReadToEnd();
Sign In or Register to comment.