﻿<PropertyGroup>      	
  <TargetFramework>net461</TargetFramework> 	
  <RuntimeIdentifier>win-x64</RuntimeIdentifier> 
</PropertyGroup>


<ItemGroup>
    <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.1" />
    <PackageReference Include="Microsoft.AspNetCore" Version="2.0.1" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.1" />
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.1" />
    <PackageReference Include="Microsoft.AspNetCore.Server.HttpSys" Version="2.0.1" />
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.0.0" />
    <PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.0.1" />
</ItemGroup>







private static string _pathToContentRoot;
        public static void Main(string[] args)
        {
            var pathToExe = Process.GetCurrentProcess().MainModule.FileName;
            _pathToContentRoot = Path.GetDirectoryName(pathToExe);

            BuildWebHost(args).RunAsService();
        }

        public static IWebHost BuildWebHost(string[] args) =>
            WebHost.CreateDefaultBuilder(args)
                .UseContentRoot(_pathToContentRoot)
                .UseStartup<Startup>()
                .UseApplicationInsights()
                .Build();









				bool isService = true;
            if (Debugger.IsAttached || args.Contains("--console"))
            {
                isService = false;
            }

            var pathToExe = Process.GetCurrentProcess().MainModule.FileName;
            _pathToContentRoot = Path.GetDirectoryName(pathToExe);

            if (isService)
            {
                BuildWebHost(args).RunAsService();
            }
            else
            {
                BuildWebHost(args).Run();
            }
