InternalsVisibleTo不起作用 [英] InternalsVisibleTo does not work

查看:824
本文介绍了InternalsVisibleTo不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我插入该行:



[汇编:InternalsVisibleTo(MyTests)]



里面我下的测试项目(属性/的AssemblyInfo.cs )其中, MyTests 是单元测试项目的名称。但由于某些原因,我仍然无法访问从单元测试项目的内部方法。



什么我做错了?


任何想法< DIV CLASS =h2_lin>解决方案

如果您的组件与一个强名称的看看这个答案



否则,请检查您的测试程序集的名称确实是MyTests.dll(它不有相匹配的项目名称,但它在默认情况下)。


I insert the line:

[assembly: InternalsVisibleTo("MyTests")]

inside my project under test( Properties/AssemblyInfo.cs) where MyTests is the name of the Unit Test project. But for some reason I still cannot access the internal methods from the unit test project.

Any ideas about what I am doing wrong ?

解决方案

If your assembly is signed with a strong name look at this answer.

Otherwise check that the name of your test assembly really is "MyTests.dll" (it doesn't have to match the project name, though it will by default).

这篇关于InternalsVisibleTo不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆