Joao Silva
Joao Silva

Reputation: 876

LinqPad access to internals of signed assemblies

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

Upvotes: 9

Views: 1074

Answers (2)

sixdiamants
sixdiamants

Reputation: 131

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")]
...

Upvotes: 0

DaveShaw
DaveShaw

Reputation: 52798

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")]

Upvotes: 12

Related Questions