Nuget Moq 4.0.10827和InternalsVisibleTo(Again) [英] Nuget Moq 4.0.10827 and InternalsVisibleTo (Again)

查看:389
本文介绍了Nuget Moq 4.0.10827和InternalsVisibleTo(Again)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在试图让MOQ(或者说Castle.Core)创建为我的内部类型的代理。



当被测添加到我的项目如下( )允许工作:

  [assembly:InternalsVisibleTo(DynamicProxyGenAssembly2)] 
 <$> 

C $ C> [汇编:InternalsVisibleTo(DynamicProxyGenAssembly2,公钥= 002400000480000094000000060200000024000052534131000400000100010077f5e87030dadccce6902c6adab7a987bd69cb5819991531f560785eacfc89b6fcddf6bb2a00743a7194e454c0273447fc6eec36474ba8e5a3823147d214298e4f9a631b1afee1a51ffeae4672d498f14b000e3d321453cdd8ac064de7e1cf4d222b7e81f54d4fd46725370d702a05b48738cc29d09228f1aa722ae1a9ca02fb)]

注意:这里的公共密钥的不同来这里记录,我重新说检查Castle.Core.dll的公钥附带起订量当前的NuGet版本。



我还是错了钥匙?





我已经注意到从官方网站(而非的NuGet)全起订量下载包含NET40-RequiresCastle文件夹一个较小的dll,这意味着Castle.Core代码已经被包含在默认Moq.dll我猜。



我一直在寻找在Castle.Core.dll他们提供Silverlight和假设他们会使用了整个同一版本?


解决方案

我知道这是旧的,但任何人谁这个跨越磕磕绊绊,我是有EX与起订量一个版本问题在一个点上,而清盘找到最直接,最有用的方法是的强名称工具。也就是说,我发现打开了一个Visual Studio命令提示符,并使用sn -Tp ThirdPartyAssembly.dll直接查询它的键。这证明比浏览互联网寻找不同的,记录的公共密钥尝试更有效。


I have been trying to get Moq (or rather Castle.Core) to create proxies for my internal types.

The following (when added to my project under test), allows things to work:

[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]

However this (more secure version) does not:

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

Note: the public key here differs to that documented here, I re-checked the public key of the Castle.Core.dll that ships with the current Nuget version of Moq.

Do I still have the wrong key?

[EDIT]

I have noticed the full Moq download from the official site (rather than Nuget) contains a NET40-RequiresCastle folder with a smaller dll, which implies that the Castle.Core code has been included in the default Moq.dll I guess.

I was looking at the Castle.Core.dll they provide for Silverlight and assuming they'd have used the same version throughout?

解决方案

I know this is old, but for anyone who stumbles across this, I was having a versioning issue with Pex and Moq at one point, and wound up finding the most direct and useful approach to be the Strong Name Tool. That is, I found opened a Visual Studio command prompt and used "sn -Tp ThirdPartyAssembly.dll" to query it for the key directly. This proved a lot more efficient than perusing the internet looking for different, documented public keys to try out.

这篇关于Nuget Moq 4.0.10827和InternalsVisibleTo(Again)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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