Last active
March 22, 2016 12:31
-
-
Save TryingToImprove/494dc73def916849eee0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using Microsoft.Extensions.PlatformAbstractions; | |
namespace ConsoleApp1 | |
{ | |
public class Program | |
{ | |
public static IServiceProvider ServiceProvider { get; private set; } | |
public Program(IServiceProvider serviceProvider) | |
{ | |
ServiceProvider = serviceProvider; | |
} | |
static void Main(string[] args) | |
{ | |
var a = PlatformServices.Default; // works | |
// ServiceProvider == nulls, so throwing | |
var re = ServiceProvider.GetService(typeof(IRuntimeEnvironment)) as IRuntimeEnvironment; //for operating system, architecture and runtime info | |
var ae = ServiceProvider.GetService(typeof(IApplicationEnvironment)); //for application path, name, version, configuration info | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "1.0.0-*", | |
"description": "ConsoleApp1 Console Application", | |
"authors": [ "Oliver" ], | |
"tags": [ "" ], | |
"projectUrl": "", | |
"licenseUrl": "", | |
"compilationOptions": { | |
"emitEntryPoint": true | |
}, | |
"dependencies": { | |
"Microsoft.Extensions.DependencyInjection.Abstractions": "1.0.0-rc1-final", | |
"Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc1-final" | |
}, | |
"commands": { | |
"ConsoleApp1": "ConsoleApp1" | |
}, | |
"frameworks": { | |
"dnxcore50": { | |
"dependencies": { | |
"Microsoft.CSharp": "4.0.1-beta-23516", | |
"System.Collections": "4.0.11-beta-23516", | |
"System.Console": "4.0.0-beta-23516", | |
"System.Linq": "4.0.1-beta-23516", | |
"System.Threading": "4.0.11-beta-23516" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment