Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

Best practices for shipping NuGet packages with global usings inside package-specific MSBuild file?

$
0
0

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:

  1. 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 if ImplicitUsings is enabled? A .NET version? A C# language version?
  2. Do I need to include a PackageReference to the package inside the ItemGroup or is that already done via the package being referenced inside the .csproj / .fsproj
  3. Is this going to be a footgun in other ways I don't know about?

Thanks!


Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>