Skip to content
This repository has been archived by the owner on Nov 20, 2018. It is now read-only.

dotnet watch doesn't honour ASPNETCORE_ENIVRONMENT variable #148

Closed
aqibgatoo opened this issue Aug 6, 2016 · 2 comments
Closed

dotnet watch doesn't honour ASPNETCORE_ENIVRONMENT variable #148

aqibgatoo opened this issue Aug 6, 2016 · 2 comments

Comments

@aqibgatoo
Copy link

I am using

set ASPNETCORE_ENVIRONMENT = Development

on command line in windows to set the environment variable then if i run

dotnet watch run

it still runs in production but if i simply do

dotnet run

it runs in Development mode.

@victorhurdugaci
Copy link
Contributor

victorhurdugaci commented Aug 6, 2016

Hi @aqibgatoo ,

I'm not able to reproduce the issue that you're mentioning. Are you running the two commands in the same console?

In my case the environment is set correctly both with run and watch run:

app victor$ dotnet run
Project app (.NETCoreApp,Version=v1.0) will be compiled because the version or bitness of the CLI changed since the last build
Compiling app for .NETCoreApp,Version=v1.0

Compilation succeeded.
    0 Warning(s)
    0 Error(s)

Time elapsed 00:00:04.2816666

Hosting environment: Production
^C

app victor$ export ASPNETCORE_ENVIRONMENT=Development
app victor$ dotnet run
Project app (.NETCoreApp,Version=v1.0) was previously compiled. Skipping compilation.
Hosting environment: Development
^C

VictorHu-Air:app victor$ dotnet watch run
[DotNetWatcher] info: Running dotnet with the following arguments: run
[DotNetWatcher] info: dotnet process id: 37079
Project app (.NETCoreApp,Version=v1.0) was previously compiled. Skipping compilation.
Hosting environment: Development
^C

set ASPNETCORE_ENVIRONMENT = Development

Also, are you running the exact command that you posted (with a space between the variable name and =)? On Windows, you must not add a space between tokens:

set a = b
echo %a%
%a%

set a=b
echo %a%
b

@aqibgatoo
Copy link
Author

aqibgatoo commented Aug 6, 2016

hi @victorhurdugaci i deleted the nuget cache and did a restore ...it ran fine after that but thanks for the info on tokens though i always tried both... but actually didn't know about the space problem in tokens

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants