I have a PCL Targeting ASP.NET CORE & .NET Framework 4.6.
In the root of PCL, I have added PCLResource.txt and marked it as Build Action > Embedded Resource.
Publish to NuGet, Installed from NuGet to my Consumer WinForm App (4.6.2)
Calling PCL.TestMethod()
works. However,
string[] asm = Assembly.GetExecutingAssembly().GetManifestResourceNames();
And
var assembly = GetType().GetTypeInfo().Assembly;
string[] resources = assembly.GetManifestResourceNames();
results in :
- PCLConsumerApp.Form1.resources
- PCLConsumerApp.Properties.Resources.resources
And
Stream stream = assembly.GetManifestResourceStream(string.Format("PCL.PCLResrouce.txt"));
results in null
Using dotPeek, I can see PCLResrouce.txt in the DLL.
How do I get access to the Embedded Resource text file as a consumer?
I have used the following resources:
- Tip: Accessing Binary Resources in Portable Class Library
- How to read a text file on Xamarin Forms PCL project?
- How to read a resource file within a Portable Class Library?
And I realize I mispelled resource :/ but thats not the issue.