简体   繁体   English

在程序集中嵌入的资源中找不到资源

[英]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.我有两个资源文件 AppMessage.en.resx 和 AppMessage.pt-BR.resx。 I also have a Designer file named AppMessage.en.Designer.cs.我还有一个名为 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:我注意到在 azure 管道中,由于这一行,它给出了错误:

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:在决赛中使用“en”,我可以重现错误:

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.但是在 Azure 管道中,它一直抱怨找不到它。 My question is, what should I put here so it can be correct?我的问题是,我应该把什么放在这里才能正确? Thanks in advance.提前致谢。

Here are the properties:以下是属性:

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

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.基本上我删除了 AppMessage.en.resx 并创建了一个 AppMessage.resx。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM