9

Is there a signed version of LinqPad that I could use in order to access internals of signed assemblies?

Joao Silva
  • 876
  • 2
  • 8
  • 18
  • Solution below won't work if your assembly signed. Please vote for the bug report at https://linqpad.uservoice.com/forums/18302-linqpad-feature-suggestions/suggestions/4837733-sign-assemblies-to-support-internalsvisibleto-for – Colonel Panic Dec 16 '15 at 16:39
  • Thx for the tip, Colonel Panic. I've cast my vote. – Joao Silva Dec 18 '15 at 17:28

2 Answers2

12

Yes. In LINQPad, go to: Edit, Preferences... and then the Advanced tab, and change the following setting:

enter image description here

And then (as it says in the screenshot) add the following to your project's AssemblyInfo.cs:

[assembly: InternalsVisibleTo("LINQPadQuery")]
DaveShaw
  • 52,123
  • 16
  • 112
  • 141
  • 2
    Unfortunately this only works if the assembly to which we need access to isn't signed. If, for example, I have an assembly in the GAC, we can't use this. – Joao Silva Oct 26 '14 at 15:59
0

Extra information for those puzzled how to insert assembly attributes into AssemblyInfo.cs; Visual Studio (tested 2022) generates MyProject.AssemblyInfo.cs from your MyProject.csproj file.

Add this to your MyProject.csproj:

<ItemGroup>
  <AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
     <_Parameter1>LINQPadQuery</_Parameter1>
  </AssemblyAttribute>
</ItemGroup>

After a rebuild, the MyProject.AssemblyInfo.cs, found in the obj directory, now contains below line:

...
[assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute("LINQPadQuery")]
...