2011-05-16 37 views
0

Iam编写测试方法(在.Net测试项目中),我需要访问解决方案的另一个项目中的resorce文件。在测试方法中访问资源文件

当然是“不可能的”,因为根据定义,Resorce文件有内部访问级别的构造,见例如:

[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 
internal class Mensagens { 

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

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

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

有没有办法解决这个?

回答

0

好的,我需要承认。我在找到问题之前找到了解决方案。 但是,我发布的问题。它可能对某人有用。

只需打开ResourceFile.Resx(双击)并在具有属性和值的网格顶部,将访问修改器更改为公开