Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Dec 18, 2017. It is now read-only.
This repository was archived by the owner on Dec 18, 2017. It is now read-only.

Referencing resources from different folder location doesn't work #668

@kanchanm

Description

@kanchanm

I am working on porting a library and am hitting some issues while trying to restructure it. Since I am reusing the code that targets older MVC version and essentially doing #if-#defs for K I am referencing code/resource files from a folder that is different from where the kproj/project.json lives. Referencing code works fine for me but I am hitting issues with resources and the only way I could get it to work is placing them under the same folder as the K project files.

Here are the things I have tried so far:

  1. DOESN’T WORK: Specify the code and resource files as below. This gives build errors complaining about missing some of the resources specified in the cs file under \Resources.
    "code": "../XYZ/*/.cs",
    “resources”: "../XYZ/Resources/.",
  2. DOESN’T WORK: Specify the code and resource files as below. This builds but throws during runtime as it is unable to load the resources.
"code": "../XYZ/**/*.cs",
“resources”: "../XYZ/Resources/*.resx", 

System.Resources.MissingManifestResourceException occurred
HResult=-2146233038
Message=Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "XYZ.Resources.Messages.resources" was correctly embedded or linked into assembly "XYZ.K" at compile time, or that all the satellite assemblies required are loadable and fully signed.
Source=mscorlib
StackTrace:
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)
at FluentValidation.Resources.Messages.get_notnull_error() in C:\Users\kanchanm\Documents\Visual Studio 14\Projects\XYZ\src\FluentValidation\Resources\Messages.Designer.cs:line 192
at XYZ.Resources.LocalizedStringSource.GetString() in C:\Users\kanchanm\Documents\Visual Studio 14\Projects\fluentvalidation\src\XYZ\Resources\LocalizedStringSource.cs:line 74
InnerException:

  1. WORKS: Duplicate the contents of “../XYZ/Resources“ under the XYZ.K project and exclude the ones under the XYZ itself.
    "code": "../XYZ/*/.cs",
    "exclude": "../XYZ/Resources",
    Note, you may see some oddities here still since there is another issue in this scenario that the namespace of the resources need to be XYZ and the original one XYZ. Resources doesn’t work in the new world (works in the old world) for some reason which seems like a different issue.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions