InternalsVisibleTo attribute isn't working

后端 未结 19 2492
眼角桃花
眼角桃花 2020-11-27 13:51

I am trying to use the InternalsVisibleTo assembly attribute to make my internal classes in a .NET class library visible to my unit test project. For some reas

19条回答
  •  再見小時候
    2020-11-27 14:06

    Applies only if you like to keep unsigned assemblies as unsigned assembly (and don't want to sign it for several reasons):

    There is still another point: if you compile your base library from VS.Net to a local directory, it may work as expected.

    BUT: As soon as you compile your base library to a network drive, security policies apply and the assembly can't be successfully loaded. This again causes VS.NET or the compiler to fail when checking for the PublicKey match.

    FINALLY, it's possible to use unsigned assemblies: https://msdn.microsoft.com/en-us/library/bb384966.aspx You must ensure that BOTH assemblies are NOT SIGNED And the Assembly attribute must be without PublicKey information:

提交回复
热议问题