c# - Embedded resources in assembly containing culture name in filename will not load -
i'm trying embed email templates in class library. works fine, until use filename containing culture-name following notation: templatename.nl-nl.cshtml resource not seem available.
example code:
namespace manifestresources { class program { static void main(string[] args) { var assembly = assembly.getexecutingassembly(); // works fine var mailtemplate = assembly.getmanifestresourcestream("manifestresources.mailtemplate.cshtml"); // not ok, localized mail template null var localizedmailtemplate = assembly.getmanifestresourcestream("manifestresources.mailtemplate.nl-nl.cshtml"); } } }
templates both have build action set 'embeddedresource'.
obvious solution use different notation, notation. has solution problem?
are sure have right name resourceset when open resourcestream? unless manifestresources project base namespace , .cshtml file lives in root folder resourceset name invalid.
the way .net projects generate resourceset name use open resource stream based on base namespace plus folder hierarchy. example:
basenamespaceofproject.views.controller.yourpage.nl-nl.cshtml
the easiest way check make sure can see resource looks open final assembly (or resource assembly) tool reflector/dotpeek , see actual embedded resourceset , resource ids are.
Comments
Post a Comment