Some context: working on distributing a new version of our core NuGet packages that has some breaking changes which can be resolved by just referencing a namespace that has been available for years.
I'm interested in shipping a {package-name}.props
file inside our NuGet package which will automatically apply the following:
<Project><ItemGroup Condition="'$(ImplicitUsings)' == 'true'"><PackageReference Include="MyProject" Version="6.1.0" /><Using Include="MyProject.NonDefaultNamespace" /></ItemGroup></Project>
Here is what I don't know how to do:
- What's the right condition to apply here if I want to apply this
global using
statement to the largest possible number of legacy users? Check ifImplicitUsings
is enabled? A .NET version? A C# language version? - Do I need to include a
PackageReference
to the package inside theItemGroup
or is that already done via the package being referenced inside the.csproj
/.fsproj
- Is this going to be a footgun in other ways I don't know about?
Thanks!