Commit 84a2483
committed
Ensure private assets always for NuGetizer
Since analyzers are transitive by default (unless PrivateAssets=all in the PackageReference), we could have been inadvertently running SL checks via project-to-project (P2P) references and causing build errors since SL requires some compiler-visible properties surfaced via MSBuild that would otherwise not be available.
This can happen if you add a package reference manually and forget to set PrivateAssets=all. But NuGetizer is *always* intended to be private assets.
After some testing, it turns out that even if we set the PrivateAssets=all via targets provided by the package itself, we can prevent this abnormal (but perhaps easy to encounter?) situation from happening at all.
This is particularly necessary with the introduction of the SponsorLink checks, since those are analyzers too, and require compiler-visible properties to be surfaced.
By forcing PrivateAssets, we make sure SponsorLink analyzer never runs on P2P projects and only on the directly referencing one.1 parent ec664c9 commit 84a2483
2 files changed
+6
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
198 | | - | |
| 198 | + | |
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
23 | 28 | | |
24 | 29 | | |
25 | 30 | | |
| |||
0 commit comments