Skip to content

Commit

Permalink
feat: disable telemetry when setting global environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
oleksbabieiev authored and hensou committed Dec 26, 2023
1 parent da92129 commit ebe399c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 20 deletions.
29 changes: 9 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,15 @@
# Contents

- [Dependencies](#dependencies)
- [Telemetry](#telemetry)
- [Install](#install)
- [Contributing](#contributing)
- [License](#license)
- [Updating DOTNET_ROOT and MsBuildSDksPath](#updating-variables)
- [Updating global environment variables](#updating-variables)

# Dependencies

- `bash`, `curl`, `grep`, `sed`, `git`: generic POSIX utilities.

# Telemetry

> :warning: Once installed, the .NET SDK will collect telemetry by default ([learn more](https://learn.microsoft.com/en-us/dotnet/core/tools/telemetry#how-to-opt-out)). If you don't want to send analytics data to Microsoft, follow the instructions below before (or after) installing the SDK.
To disable telemetry, add the following line to your shell profile (`~/.bashrc`, `~/.zshrc`, `~/.config/fish/config.fish`, etc.):

```shell
export DOTNET_CLI_TELEMETRY_OPTOUT=1
```

Once added, reload your profile for the changes to take effect.

```shell
exec $SHELL
```

# Install

Installing this plugin:
Expand Down Expand Up @@ -67,9 +50,15 @@ dotnet --version
Check [asdf](https://github.com/asdf-vm/asdf) readme for more instructions on how to
install & manage versions.

# <a id="updating-variables"></a>Updating DOTNET_ROOT and MsBuildSDksPath
# <a id="updating-variables"></a>Updating global environment variables

If you need to:

- update/set `DOTNET_ROOT` variable
- update/set `MsBuildSDksPath` variable
- disable telemetry (i.e. set `DOTNET_CLI_TELEMETRY_OPTOUT` to 1)

According to your shell, add the following instructions to update or set the DOTNET_ROOT and MsBuildSDksPath environment variables:
then, according to your shell, execute one of the following commands:

For bash, use:

Expand Down
1 change: 1 addition & 0 deletions set-dotnet-env.bash
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ asdf_update_dotnet_home() {
export MSBuildSDKsPath
DOTNET_VERSION="$(dotnet --version)"
export MSBuildSDKsPath="$DOTNET_ROOT/sdk/$DOTNET_VERSION/Sdks"
export DOTNET_CLI_TELEMETRY_OPTOUT=1
fi
}

Expand Down
1 change: 1 addition & 0 deletions set-dotnet-env.fish
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ function asdf_update_dotnet_home --on-event fish_prompt
set -gx DOTNET_ROOT (dirname "$full_path")
set --local dotnet_version (string replace -r '.*/installs/dotnet/(.+)/[.].*' '$1' $dotnet_path)
set -gx MSBuildSDKsPath (realpath "$DOTNET_ROOT/sdk/$dotnet_version/Sdks")
set -gx DOTNET_CLI_TELEMETRY_OPTOUT 1
end
end
1 change: 1 addition & 0 deletions set-dotnet-env.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ asdf_update_dotnet_home() {
export MSBuildSDKsPath
DOTNET_VERSION="$(dotnet --version)"
export MSBuildSDKsPath="$DOTNET_ROOT/sdk/$DOTNET_VERSION/Sdks"
export DOTNET_CLI_TELEMETRY_OPTOUT=1
fi
}

Expand Down

0 comments on commit ebe399c

Please sign in to comment.