title: How can I use Microsoft.Extensions.DependencyInjection in an .NET Core console app?
body: <p>I have a library that I would like to run on all platforms supported by .NET Core (Xamarin, Windows, Mac).  And to do this I need to have a cross platform DI to handle the platform specific customizations such as storage, security, etc.</p>
  
  <p>All of the examples I've seen for <code>Microsoft.Extensions.DependencyInjection</code> include code for ASP.NET Core.  Does any equivalent / supported scenario exist for a console app?</p>
  
  <p>Alternatively (ideally) I would like the DI framework used for the console to work for ASP.NET Core, Xamarin, and Win32</p>
  
  <p><strong>Error Example</strong></p>
  
  <p>I'm using <a href="https://msdn.microsoft.com/en-us/magazine/mt707534.aspx" rel="noreferrer">this code</a> as the basis for my .NET Core application. It appears that <a href="https://msdn.microsoft.com/en-us/magazine/mt707534.aspx" rel="noreferrer">ServiceCollection</a> should be public, but when I use Xamarin on the Mac the default implementation of <code>IServiceCollection</code> (ServiceCollection) is missing:</p>
  
  <p><a href="https://i.stack.imgur.com/XO6xj.png" rel="noreferrer"><img src="https://i.stack.imgur.com/XO6xj.png" alt="enter image description here"></a></p>