16

.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?

Ben Gribaudo
  • 5,057
  • 1
  • 40
  • 75

1 Answers1

30

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.

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
  • 1
    ASP.NET Core projects don't have `AssemblyInfo.cs` file. – Nikolay Kostov Jun 12 '17 at 11:30
  • 1
    You now get a lot of `assemblyinfo.cs` auto-generated for you from the package info part of the csproj file. It generates a CS file for you, e.g.: `MyProject\obj\Debug\netstandard1.6\MyProject.AssemblyInfo.cs`. It doesn't do the InternalsVisibleTo though, as before. – Chris S Jun 13 '17 at 16:11
  • 2
    @ChrisS: I certainly wouldn't expect it to add InternalsVisibleTo, of course. The point is that it's fine for the autogenerated file and a manual file to live together. – Jon Skeet Jun 13 '17 at 18:07