Reputation: 49619
I have a lot of assemblies that have set the InternalsVisibleToAttribute pointing one specifc assembly within the same solution. Unfortunately the assembly that is being pointed to has a stong name, so I always have to put the same public key token over and over again into the AssemblyInfo.cs files. Since there is no precompiler in c#, how would I ideally eliminate this redundancy.
Upvotes: 1
Views: 200
Reputation: 20992
You have a couple of easy-ish options:
#1 is somewhat simpler to manage, but it has the unfortunate side-effect of removing IntelliSense support for the referenced internals in the referencing project.
#2 is somewhat more complex to manage, but it doesn't interfere with IntelliSense support.
Upvotes: 1
Reputation: 1851
maybe you could use t4
rename AssemblyInfo.cs
to AssemblyInfo.tt
and add something like this
<#@ template language="C#v3.5" hostspecific="True" debug="True" #>
<#@ output extension="cs" #>
[assembly: InternalsVisibleTo("<# Write(System.Reflection.Assembly.GetExecutingAssembly().FullName); #>")]
Upvotes: 0