Another year, another question about Moles. I've got an assembly with an internal sealed class that I'd like to mole in the test project that I use for unit tests.
According to the Moles documentation I should add an
[assembly: InternalsVisibleTo( "MyAssembly.Moles" )]
attribute so I can access the internal class from my test project. However, this unfortunately doesn't work as "MyAssembly" is strongly signed.
Therefore, following the documentation, I added the Public Key to the line above, resulting in
[assembly: InternalsVisibleTo( "MyAssembly.Moles, PublicKey=0123456..." )]
Unfortunately this now gives me the following error when compiling "MyAssembly":
Assembly reference 'MyMoles.Moles, PublicKey=0123456...' is invalid and cannot be resolved
The documentation says that "...the Moles framework always uses the same key to sign the assembly...", but as the compiler says, this does not work. I also checked the generated file "MyAssembly.Moles.dll" with Reflector to verify that I use the correct public key (which I do), so I am stuck as I don't really know what the problem is.
Any ideas?