My Visual Studio 2015 solution has the following projects:
The PCL assembly contains an embedded string resource table (via an RESX file in the project) and a simple class that allows callers to get strings out of the string resource table. The PCL is designed to allow sharing of strings between the .NET and UWP assemblies.
When the .NET Unit Test Library is run, the unit tests call the .NET assembly, which gets strings out of the PCL assembly. This works as expected.
When the UWP Unit Test App is run, the unit tests call the UWP assembly, which gets strings out of the PCL assembly. This fails with the following exception message:
System.Resources.MissingManifestResourceException: Unable to load resources for resource file [blah] in package [guid].
I tried this solution, but the call to GetForViewIndependentUse()
failed with a COMException
stating that "ResourceMap Not Found".
What's going on? This call chain works for the .NET unit test stack. I have checked to ensure that the Neutral Language is set to "English" for all assemblies. What is the best way for me to share a string table between the .NET assembly and the UWP assembly?
I was dealing with same "MissingManifestResourceException" for the past few days. I also checked the Microsoft Blog Post and this MVP Post regarding Xamarin. After applying the proposed solutions I got the same error as you "ResourceMap Not Found".
Finally, I decided to go back to the main issue and I carefully checked the description for the error "MissingManifestResourceException" in MSDN, and it says:
The exception that is thrown if the main assembly does not contain the resources for the neutral culture, and an appropriate satellite assembly is missing.
Source: https://msdn.microsoft.com/en-us/library/system.resources.missingmanifestresourceexception(v=vs.110).aspx
So, I just went to PCL and set a Neutral Culture (Language)
- In Solution Explorer, right-click your project, and then Click Properties.
- From the left navigation bar select Application, and then click Assembly Information.
- In the Assembly Information dialog box, select the language from the Neutral Language drop-down list.
- Click OK.
Source: https://msdn.microsoft.com/en-us/library/bb385967.aspx
Problem Solved!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With