Reputation: 377
I am referencing a standard .NET 4.5 library from ASP.NET 5 MVC 6 project. The code in the library works perfectly from .NET 4.6 application, but when I use it from MVC 6 project it shows error:
System.IO.FileNotFoundException Could not find file 'CustomLibrary.resources'.
The reference library get strings from Embeded Resx file.
The stack trace for error is:
at System.Reflection.RuntimeAssembly.InternalGetSatelliteAssembly(String name, CultureInfo culture, Version version, Boolean throwOnFileNotFound, StackCrawlMark& stackMark)
at System.Resources.ManifestBasedResourceGroveler.GetSatelliteAssembly(CultureInfo lookForCulture, StackCrawlMark& stackMark)
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)
Any idea how to resolve this ?
Upvotes: 2
Views: 997
Reputation: 353
A workaround that I used to fix a similar issue was to remove localization support by adding this to Startup.cs:
var localizationOptions = new RequestLocalizationOptions()
{
SupportedCultures = new List<CultureInfo> { new CultureInfo("") },
SupportedUICultures = new List<CultureInfo> { new CultureInfo("") }
};
var invariantCulture = new RequestCulture(new CultureInfo(""), new CultureInfo(""));
app.UseRequestLocalization(localizationOptions, invariantCulture);
This is based on the solution suggested at https://github.com/aspnet/EntityFramework/issues/4422
Upvotes: 3