2020-10-16 08:43:02 -07:00
---
id: dotnet
title: Dotnet
sidebar_label: Dotnet
---
## What
2022-05-04 16:46:06 -07:00
Display the currently active [.NET SDK][net-sdk-docs] version.
2020-10-16 08:43:02 -07:00
## Sample Configuration
2024-11-08 03:04:41 -08:00
import Config from "@site/src/components/Config.js";
2023-03-31 11:55:36 -07:00
2024-11-08 03:04:41 -08:00
<Config
data={{
type: "dotnet",
style: "powerline",
powerline_symbol: "\uE0B0",
foreground: "#000000",
background: "#00ffff",
template: " \uE77F {{ .Full }} ",
}}
/>
2020-10-16 08:43:02 -07:00
## Properties
2024-11-08 03:04:41 -08:00
| Name | Type | Default | Description |
2024-04-04 14:20:48 -07:00
| ---------------------- | :--------: | :----------------------------------------------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
2024-11-08 03:04:41 -08:00
| `home_enabled` | `boolean` | `false` | display the segment in the HOME folder or not |
| `fetch_version` | `boolean` | `true` | fetch the active version or not; useful if all you need is an icon indicating `dotnet` |
2024-11-17 02:14:46 -08:00
| `cache_duration` | `string` | `none` | the duration for which the version will be cached. The duration is a string in the format `1h2m3s` and is parsed using the [time.ParseDuration] function from the Go standard library. To disable the cache, use `none` |
2024-11-08 03:04:41 -08:00
| `missing_command_text` | `string` | | text to display when the command is missing |
| `display_mode` | `string` | `context` | <ul><li>`always`: the segment is always displayed</li><li>`files`: the segment is only displayed when file `extensions` listed are present</li><li>`context`: displays the segment when the environment or files is active</li></ul> |
| `version_url_template` | `string` | | a go [text/template][go-text-template] [template][templates] that creates the URL of the version info / release notes |
2024-04-04 14:20:48 -07:00
| `extensions` | `[]string` | `*.cs, *.csx, *.vb, *.fs, *.fsx, *.sln, *.slnf, *.csproj, *.fsproj, *.vbproj, global.json` | allows to override the default list of file extensions to validate |
| `folders` | `[]string` | | allows to override the list of folder names to validate |
2021-11-07 10:55:22 -08:00
2022-02-01 03:10:46 -08:00
## Template ([info][templates])
:::note default template
2022-09-16 07:32:48 -07:00
```template
2022-02-01 03:10:46 -08:00
{{ if .Unsupported }}\uf071{{ else }}{{ .Full }}{{ end }}
```
:::
### Properties
2021-11-07 10:55:22 -08:00
2022-09-16 07:32:48 -07:00
| Name | Type | Description |
| ---------------- | -------- | -------------------------------------------------- |
| `.Full` | `string` | the full version |
| `.Major` | `string` | major number |
| `.Minor` | `string` | minor number |
| `.Patch` | `string` | patch number |
| `.Prerelease` | `string` | prerelease info text |
| `.BuildMetadata` | `string` | build metadata |
| `.URL` | `string` | URL of the version info / release notes |
| `.Error` | `string` | error encountered when fetching the version string |
2021-11-07 10:55:22 -08:00
2022-05-16 08:20:03 -07:00
[go-text-template]: https://golang.org/pkg/text/template/
2022-04-20 09:43:59 -07:00
[templates]: /docs/configuration/templates
2022-05-04 16:46:06 -07:00
[net-sdk-docs]: https://docs.microsoft.com/en-us/dotnet/core/tools
2024-11-08 03:04:41 -08:00
[time.ParseDuration]: https://golang.org/pkg/time/#ParseDuration