project.json Equivalent of InternalsVisibleTo
Asked Answered
I

1

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?

Imprescriptible answered 27/10, 2016 at 13:41 Comment(0)
B
29

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.

Babb answered 27/10, 2016 at 13:42 Comment(3)
ASP.NET Core projects don't have AssemblyInfo.cs file.Alyosha
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.Shipper
@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.Babb

© 2022 - 2024 — McMap. All rights reserved.