Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set the value in a command shell for dotnet core

Running dotnet core command dotnet run in a command line I found this

You can opt out of telemetry by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 using your favorite shell.

DOTNET_CLI_TELEMETRY_OPTOUT

How do I set this variable?

Thanks for your time.

like image 365
Hamza Ahmed Zia Avatar asked Sep 03 '16 11:09

Hamza Ahmed Zia


People also ask

What is telemetry in .NET core?

NET Core agents use telemetry to collect usage data. Telemetry is collected when an instrumented application first loads the agent's sensors and then periodically (every few hours) afterwards. Your privacy is important to us. The telemetry feature doesn't collect application data.

Where is the dotnet command?

In System variables, select path and edit. After semicolon, write "C:\Program Files\dotnet"


2 Answers

On Windows use

set DOTNET_CLI_TELEMETRY_OPTOUT=1 

to avoid that telemetry data is sent by dotnet.exe in the current command line session.

Or use

setx DOTNET_CLI_TELEMETRY_OPTOUT 1 

do disable this feature permanently.

like image 84
Ralf Bönning Avatar answered Oct 05 '22 23:10

Ralf Bönning


To set environment variable only for current cmd session write set DOTNET_CLI_TELEMETRY_OPTOUT=1 or set DOTNET_CLI_TELEMETRY_OPTOUT=true (according to .NET Core Tools Telemetry)

To set environment variable permanently use setx instead of set.

Edit: For setx it has to be setx DOTNET_CLI_TELEMETRY_OPTOUT 1, and changes will only take effect when a new command window is opened - they do not affect the current CMD.

Developer Command Prompt is started with this .bat file: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsDevCmd.bat so you can edit it and add permanent changes.

like image 32
mx0 Avatar answered Oct 05 '22 21:10

mx0