Nuget Moq 4.0.10827 and InternalsVisibleTo (again)

I am trying to get Moq (or rather Castle.Core) to create a proxy for my internal types.

The following (when added to my test project) allows you to work:

[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] 

However, this (safer version) does not:

 [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=002400000480000094000000060200000024000052534131000400000100010077f5e87030dadccce6902c6adab7a987bd69cb5819991531f560785eacfc89b6fcddf6bb2a00743a7194e454c0273447fc6eec36474ba8e5a3823147d214298e4f9a631b1afee1a51ffeae4672d498f14b000e3d321453cdd8ac064de7e1cf4d222b7e81f54d4fd46725370d702a05b48738cc29d09228f1aa722ae1a9ca02fb")] 

Note: the public key here is different from that described here , I re-checked the public key of the lock. Core.dll, which comes with the current version of Moug for Nuget.

Do I still have the wrong key?

[EDIT]

I noticed that the full Moq download from the official site (not Nuget) contains the NET40-RequiresCastle folder with a lower dll, which implies that Castle.Core code was included in the default Moq.dll file, I think.

I looked at the Castle.Core.dll file that they provide for Silverlight, and suggesting that they would use the same version all over?

+4
source share
1 answer

I know this is old, but for everyone who stumbled over it, I had a problem with the version with Pex and Moq at some point, and I found the most direct and useful approach as Strong Name . That is, I discovered that I opened the Visual Studio command prompt and used "sn -Tp ThirdPartyAssembly.dll" to request it for the key directly. This turned out to be much more effective than browsing the Internet looking for different, documented public keys to try.

+7
source

Source: https://habr.com/ru/post/1368933/


All Articles