zupp
zupp

Reputation: 138

Could not find the resource among the resources embedded in the assembly

I have two resource files AppMessage.en.resx and AppMessage.pt-BR.resx. I also have a Designer file named AppMessage.en.Designer.cs.

This is my Designer file:

[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    public class AppMessage {
        
        private static global::System.Resources.ResourceManager resourceMan;
        
        private static global::System.Globalization.CultureInfo resourceCulture;
        
        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        internal AppMessage() {
        }
        
        /// <summary>
        ///   Returns the cached ResourceManager instance used by this class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        public static global::System.Resources.ResourceManager ResourceManager {
            get {
                if (object.ReferenceEquals(resourceMan, null)) {
                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Ultrasonic.Customers.Application.Resources.AppMessage", typeof(AppMessage).Assembly);
                    resourceMan = temp;
                }
                return resourceMan;
            }
        }
        
        /// <summary>
        ///   Overrides the current thread's CurrentUICulture property for all
        ///   resource lookups using this strongly typed resource class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        public static global::System.Globalization.CultureInfo Culture {
            get {
                return resourceCulture;
            }
            set {
                resourceCulture = value;
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to Employee must be 15 years of age or older..
        /// </summary>
        public static string Validation_BirthDate {
            get {
                return ResourceManager.GetString("Validation.BirthDate", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to {PropertyName} Must be a valid date, greater or equals tomorrow.
        /// </summary>
        public static string Validation_CreditDate {
            get {
                return ResourceManager.GetString("Validation.CreditDate", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to {PropertyName} cannot be null.
        /// </summary>
        public static string Validation_NullCheck {
            get {
                return ResourceManager.GetString("Validation.NullCheck", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to {PropertyName} Invalid Date.
        /// </summary>
        public static string Validation_ValidDate {
            get {
                return ResourceManager.GetString("Validation.ValidDate", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to {PropertyName} only digits allowed, must be 8 caracters lenth.
        /// </summary>
        public static string Validation_ZipCode {
            get {
                return ResourceManager.GetString("Validation.ZipCode", resourceCulture);
            }
        }
    }

I noticed that in the azure pipeline it gives the error due to this line:

global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Ultrasonic.Customers.Application.Resources.AppMessage", typeof(AppMessage).Assembly);

Locally when i change it to:

"Ultrasonic.Customers.Application.Resources.AppMessage.en"

with the "en" on the final, i can reproduce the error:

Message: 
    System.Resources.MissingManifestResourceException : Could not find the resource "Ultrasonic.Customers.Application.Resources.AppMessage.en.resources" among the resources "" embedded in the assembly "Ultrasonic.Customers.Application", nor among the resources in any satellite assemblies for the specified culture. Perhaps the resources were embedded with an incorrect name.

And when i change it back to:

"Ultrasonic.Customers.Application.Resources.AppMessage"

locally seems resolved. But in Azure pipelines, it keeps complaining about not finding it. My question is, what should I put here so it can be correct? Thanks in advance.

Here are the properties:

enter image description here

enter image description here

enter image description here

Upvotes: 1

Views: 1801

Answers (1)

zupp
zupp

Reputation: 138

In case someone is going through this, just leave a neutral file, with a Designer. this solves the problem.

Basically I deleted the AppMessage.en.resx and created an AppMessage.resx.

Upvotes: 1

Related Questions