I tried including a resx file in a class library (netstandard1.6) and got the following error:
System.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "MyCorp.Strings.resources" was correctly embedded or linked into assembly "MyCorp.Lib" at compile time, or that all the satellite assemblies required are loadable and fully signed.
at System.Resources.ManifestBasedResourceGroveler.HandleResourceStreamMissing(String fileName)
at System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean createIfNotExists, StackCrawlMark& stackMark)
at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo requestedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark& stackMark)
at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
at System.Resources.ResourceManager.GetString(String name, CultureInfo culture)
I tried various google results, and discovered that the problem is that the .resources file was produced under the name of "MyCorp.Lib.Strings.resources". The error though is looking for "MyCorp.Strings.resources".
This is because in the Application properties for the library project, the Default Namespace option was set to "MyCorp". And so the resource file was in the namespace of "MyCorp.Strings", not "MyCorp.Lib.Strings".
I couldn't get the new buildOptions->embed section to handle this properly, but I did get the older resource version to work as per below:
It wasn't that the file was not included in the build output, it just used the wrong name. This configuation enforces that the resources file gets created with the correct name to be located by.
I couldn't find a way of enforcing the naming using the buildOptions approach, but I suspect that the wrong label is being used for the .resources file output.
@nullcat0 DNX is no longer supported. Looking at your bug report, it looks like you might already be using Dotnet CLI. You can file issues for it here - http://github.com/dotnet/cli/issues.
I tried including a resx file in a class library (netstandard1.6) and got the following error:
I tried various google results, and discovered that the problem is that the .resources file was produced under the name of "MyCorp.Lib.Strings.resources". The error though is looking for "MyCorp.Strings.resources".
This is because in the Application properties for the library project, the Default Namespace option was set to "MyCorp". And so the resource file was in the namespace of "MyCorp.Strings", not "MyCorp.Lib.Strings".
I couldn't get the new buildOptions->embed section to handle this properly, but I did get the older resource version to work as per below:
It wasn't that the file was not included in the build output, it just used the wrong name. This configuation enforces that the resources file gets created with the correct name to be located by.
I couldn't find a way of enforcing the naming using the buildOptions approach, but I suspect that the wrong label is being used for the .resources file output.
Regards, Rob.