0

I have created a project(ProjectA [Class Library]) that contains a class with internal access modifier in c# (VS2015), target framework 4.5.2. I have generated public key and used in the asssemblyinfo.cs as shown in code below.

[assembly:InternalsVisibleTo("ProjectB,PublicKey=publickey")]

ProjectA (Class library) gets compiled. Now I am referencing this (ProjectA)dll from "ProjectB"(class library) and calling the function in the ProjectA Class. Project B is also strongly signed. When I compile ProjectB, I get compile time error:

error CS0122: 'Queries' is inaccessible due to its protection level

I followed the steps mentioned here. I would appreciate if anyone could help me with this issue.

Am I missing some steps? Do I need to use the public token somewhere. How can I use it?

dymanoid
  • 14,771
  • 4
  • 36
  • 64
sabin
  • 233
  • 1
  • 4
  • 18
  • Can we see the `Queries` class declaration as well as the line of code that calls it? – Steve Danner Jul 07 '20 at 13:41
  • `publickey` is the 320 character public key (not just the public key token)? And this is in fact the public key from the snk file used to sign ProjectB? – Klaus Gütter Jul 07 '20 at 13:42
  • @KlausGütter, I have used the 320 characters public key with the "InternalsVisibleTo" attribute. [assembly:InternalsVisibleTo("ProjectB,PublicKey=<320 characters key")] So, I need to sign the ProjectB with the public token? – sabin Jul 07 '20 at 18:42
  • There is no such thing as a "public token". As I said, you need to sign ProjectB withe the snk file corresponding to the public key. This snk contains the private key. – Klaus Gütter Jul 07 '20 at 18:58

0 Answers0