InternalsVisibleTo不起作用 [英] InternalsVisibleTo does not work
问题描述
我插入该行:
[汇编: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屋!