1

我创建了一个 Silverlight 业务应用程序并希望使用 App_GlobalResources。

这些资源位于同一个项目 (TestApp.Web) 中。试图通过 System.Resources 使用一些资源。在一个类中不起作用,因为没有列出类。

我只看到 RegistrationDataResources 和 ValidationErrorResources。

也许你有一个想法?

编辑:使用 Resources.te23。出现错误。“Type or Namspace te23 is not available in TestApp.Web.Resources”(翻译成英文)

“te23”资源的内容(我删除了评论)。

namespace Resources {
using System;
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Web.Application.StronglyTypedResourceProxyBuilder", "10.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class te23 {
    private static global::System.Resources.ResourceManager resourceMan; 
    private static global::System.Globalization.CultureInfo resourceCulture;

    [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
    internal te23() {
    }
   [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
    internal static global::System.Resources.ResourceManager ResourceManager {
        get {
            if (object.ReferenceEquals(resourceMan, null)) {
                global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Resources.te23", global::System.Reflection.Assembly.Load("App_GlobalResources"));
                resourceMan = temp;
            }
            return resourceMan;
        }
    }
    [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
    internal static global::System.Globalization.CultureInfo Culture {
        get {
            return resourceCulture;
        }
        set {
            resourceCulture = value;
        }
    }
    internal static string test {
        get {
            return ResourceManager.GetString("test", resourceCulture);
        }
    }
}

}

4

3 回答 3

0

只是一个想法,你有图书馆对特定图书馆的引用吗?

于 2012-07-05T08:01:39.040 回答
0

这通常是构建问题。验证 .resx 文件的自定义工具属性是否设置为“GlobalResourceProxyGenerator”。

(请注意,您将使用Resources.MyResxFile.ResourceName访问资源。)

于 2012-07-05T08:20:22.830 回答
0

我已将命名空间从 Resources 编辑到 TestApp.Web.Resources。现在它们是资源下的列表。

于 2012-07-12T07:18:14.947 回答