Commit afbb379
committed
Add support for @(InternalsVisibleTo) items that turn into assembly attributes
Given that `InternalsVisibleTo` (IVT) is such a common assembly-level attribute, this adds support
for specifying it directly via simple items, such as:
```
<ItemGroup>
<InternalsVisibleTo Include="MyLibrary.Tests" />
</ItemGroup>
```
Optionally, a `Key` metadata can be specified to provide a strong-named IVT:
```
<ItemGroup>
<InternalsVisibleTo Include="MyLibrary.Tests" Key="PUBLIC_KEY" />
</ItemGroup>
```
The targets will also use automatically a `$(PublicKey)` if available and no `%(Key)` metadata
override is found. Otherwise, it will default to an IVT without a key.
This also avoids having to learn the `_Parameter1` syntax in `AssemblyAttribute` elements, and is
more similar to the way other higher-level properties like `AssemblyTitle` or `Product` are also
turned into assembly attributes.
To turn off this feature, set `$(GenerateInternalsVisibleToAttributes)` to `false`.
Partially fixes #31661 parent 095fe9b commit afbb379
File tree
1 file changed
+6
-0
lines changed- src/Tasks/Microsoft.NET.Build.Tasks/targets
1 file changed
+6
-0
lines changedLines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| |||
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
97 | 103 | | |
98 | 104 | | |
99 | 105 | | |
| |||
0 commit comments