2015-10-27 40 views
2

我引用了ASP.NET 5 MVC 6項目中的標準.NET 4.5庫。 庫中的代碼從.NET 4.6的應用程序完美的作品,但是當我用它從MVC 6項目它顯示錯誤:ASP.NET 5應用程序錯誤:System.IO.FileNotFoundException找不到文件'CustomLibrary.resources'

System.IO.FileNotFoundException Could not find file 'CustomLibrary.resources'. 

參考庫得到嵌入式的RESX文件中的字符串。

堆棧跟蹤誤差爲:

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) 

不知道如何解決這個問題?

+1

問題在這裏註冊:https://github.com/aspnet/dnx/issues/3023 –

+0

謝謝,是否有任何解決方法,直到它被修復? – WaldiMen

回答

3

,我用來解決類似問題的解決方法是通過增加這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); 

這是基於該解決方案建議在https://github.com/aspnet/EntityFramework/issues/4422

相關問題