Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Commit a40adab

Browse files
In non-ASP.NET apps, default project path to current working directory. Fixes #1100.
1 parent c2a284d commit a40adab

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

samples/misc/LatencyTest/Program.cs

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ public static void Main(string[] args) {
2121
// Since .NET Core 1.1, the HTTP hosting model has become basically as fast as the Socket hosting model
2222
//options.UseSocketHosting();
2323

24-
options.ProjectPath = Directory.GetCurrentDirectory();
2524
options.WatchFileExtensions = new string[] {}; // Don't watch anything
2625
});
2726
var serviceProvider = services.BuildServiceProvider();

src/Microsoft.AspNetCore.NodeServices/Configuration/NodeServicesOptions.cs

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.IO;
34
using System.Threading;
45
using Microsoft.AspNetCore.NodeServices.HostingModels;
56
using Microsoft.Extensions.Logging;
@@ -34,14 +35,18 @@ public NodeServicesOptions(IServiceProvider serviceProvider)
3435
InvocationTimeoutMilliseconds = DefaultInvocationTimeoutMilliseconds;
3536
WatchFileExtensions = (string[])DefaultWatchFileExtensions.Clone();
3637

37-
// In an ASP.NET environment, we can use the IHostingEnvironment data to auto-populate a few
38-
// things that you'd otherwise have to specify manually
3938
var hostEnv = serviceProvider.GetService<IHostingEnvironment>();
4039
if (hostEnv != null)
4140
{
41+
// In an ASP.NET environment, we can use the IHostingEnvironment data to auto-populate a few
42+
// things that you'd otherwise have to specify manually
4243
ProjectPath = hostEnv.ContentRootPath;
4344
EnvironmentVariables["NODE_ENV"] = hostEnv.IsDevelopment() ? "development" : "production"; // De-facto standard values for Node
4445
}
46+
else
47+
{
48+
ProjectPath = Directory.GetCurrentDirectory();
49+
}
4550

4651
var applicationLifetime = serviceProvider.GetService<IApplicationLifetime>();
4752
if (applicationLifetime != null)

0 commit comments

Comments
 (0)