project.json Equivalent of InternalsVisibleTo

2019-04-04 04:55发布

问题:

.Net Core's project.json allows configuration of various assembly properties (e.g. title, version, copyright) that a traditional .Net application would define using attributes typically placed in AssemblyInfo.cs (e.g. AssemblyTitle, AssemblyCopyright, AssemblyVersion). However, one assembly property I haven't figured out how to set in project.json is InternalsVisibleTo.

Is there a way to use project.json to indicate that another assembly should have internal visibility into the current project?

回答1:

No - just put it in AssemblyInfo.cs as normal. That's still a perfectly fine place to put assembly attributes. If one isn't created for you in the template you're using, just create your own AssemblyInfo.cs file (or any other name, of course). You can put the assembly attributes wherever you want, basically.