Intellisence无法识别资源文件

时间:2015-11-22 16:02:12

标签: c# asp.net-mvc-3

我在Resource文件夹中有三个资源文件,分别是Account,Home和Novel。编码唯一的资源文件时,我可以找到:

Resources.

是Home文件。我把这三个都公之于众,据我所知,三者之间没有区别。

家居设计师档案:

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.42000
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace Resources.Home {
    using System;


    /// <summary>
    ///   A strongly-typed resource class, for looking up localized strings, etc.
    /// </summary>
    // This class was auto-generated by the StronglyTypedResourceBuilder
    // class via a tool like ResGen or Visual Studio.
    // To add or remove a member, edit your .ResX file then rerun ResGen
    // with the /str option, or rebuild your VS project.
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    public class Home {

        private static global::System.Resources.ResourceManager resourceMan;

        private static global::System.Globalization.CultureInfo resourceCulture;

        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        internal Home() {
        }

        /// <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("TheNovelMachine.Resource.Home", typeof(Home).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 &lt;h1&gt;Your &lt;span&gt;Story&lt;/span&gt; Starts &lt;span&gt;Here&lt;/span&gt;...&lt;/h1&gt;.
        /// </summary>
        public static string Heading {
            get {
                return ResourceManager.GetString("Heading", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to &lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec blandit purus varius est ornare vehicula. Sed eget hendrerit justo, nec pulvinar quam. Etiam eget tellus nunc. Nullam fermentum nunc enim, at placerat eros convallis eget. Aenean sed elit non nisl tempor molestie. Fusce porta est ut sem faucibus tincidunt. Ut facilisis dapibus lacus, sed mattis justo accumsan et.&lt;/p&gt;
        ///
        ///    &lt;p&gt;Sed ut lobortis sapien. Morbi sit amet nulla non leo pharetra aliquam. Cras vel laoreet orci, ac imperdiet quam. Pell [rest of string was truncated]&quot;;.
        /// </summary>
        public static string Intro {
            get {
                return ResourceManager.GetString("Intro", resourceCulture);
            }
        }
    }
}

Novel Designer File:

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.42000
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace TheNovelMachine.Resource {
    using System;


    /// <summary>
    ///   A strongly-typed resource class, for looking up localized strings, etc.
    /// </summary>
    // This class was auto-generated by the StronglyTypedResourceBuilder
    // class via a tool like ResGen or Visual Studio.
    // To add or remove a member, edit your .ResX file then rerun ResGen
    // with the /str option, or rebuild your VS project.
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    public class Novel {

        private static global::System.Resources.ResourceManager resourceMan;

        private static global::System.Globalization.CultureInfo resourceCulture;

        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        internal Novel() {
        }

        /// <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("TheNovelMachine.Resource.Novel", typeof(Novel).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 We want to know what it&apos;s all about!.
        /// </summary>
        public static string AbstractRequired {
            get {
                return ResourceManager.GetString("AbstractRequired", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Action and Adventure.
        /// </summary>
        public static string GenreAction {
            get {
                return ResourceManager.GetString("GenreAction", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Children&apos;s.
        /// </summary>
        public static string GenreChildren {
            get {
                return ResourceManager.GetString("GenreChildren", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Drama.
        /// </summary>
        public static string GenreDrama {
            get {
                return ResourceManager.GetString("GenreDrama", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Fantasy.
        /// </summary>
        public static string GenreFantasy {
            get {
                return ResourceManager.GetString("GenreFantasy", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Historical.
        /// </summary>
        public static string GenreHistory {
            get {
                return ResourceManager.GetString("GenreHistory", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Horror.
        /// </summary>
        public static string GenreHorror {
            get {
                return ResourceManager.GetString("GenreHorror", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Mystery.
        /// </summary>
        public static string GenreMystery {
            get {
                return ResourceManager.GetString("GenreMystery", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Choose a Genre, so your novel knows where to live!.
        /// </summary>
        public static string GenreRequired {
            get {
                return ResourceManager.GetString("GenreRequired", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Romance.
        /// </summary>
        public static string GenreRomance {
            get {
                return ResourceManager.GetString("GenreRomance", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Satire.
        /// </summary>
        public static string GenreSatire {
            get {
                return ResourceManager.GetString("GenreSatire", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Sci-Fi.
        /// </summary>
        public static string GenreScifi {
            get {
                return ResourceManager.GetString("GenreScifi", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Your novel needs a name!.
        /// </summary>
        public static string TitleRequired {
            get {
                return ResourceManager.GetString("TitleRequired", resourceCulture);
            }
        }
    }
}

1 个答案:

答案 0 :(得分:1)

它们位于不同的名称空间中。将using TheNovelMachine;添加到您尝试使用这些资源的C#文件的顶部,或在代码中的某处键入Resource,然后右键单击它,并在上下文菜单的顶部,你应该有一个选项说Resolve。突出显示它,它会为您提供添加using TheNovelMachine;

的选项

或者,将您的Resource文件放在Resources命名空间中。