Code of Conduct
What would you like to see changed?
Context
The project segment correctly detects .sln files and shows the .NET icon, but does not
display any version information when working in a solution folder where only a .sln file
is present (no .csproj directly in the folder).
This is the standard workflow for .NET developers: the .sln file lives at the repo root,
while individual .csproj files live in subdirectories. Git operations (git status,
git push, etc.) are always performed from the solution folder, not from individual
project folders.
Current behavior
Given this folder structure:
MyApp/
MyApp.sln ← working directory
src/
MyApp.Api/
MyApp.Api.csproj (TargetFramework: net8.0)
MyApp.Domain/
MyApp.Domain.csproj
When in MyApp/, the project segment shows the .NET icon but no version.
Expected behavior
The segment should resolve the TargetFramework of the startup/first project in the
solution and display it.
Proposed implementation
When the current directory contains a .sln file but no .csproj directly, the segment
should search one level deeper (non-recursively to avoid performance impact) for .csproj
files and read the TargetFramework element from the first match.
Alternatively, a new property search_subdirectories (boolean, default false) could
opt in to this behavior explicitly, giving users control over performance vs. information
tradeoff.
Reference
This is related to the closed issue #1568 ("Enhance dotnet segment to support .Net
framework") and the associated discussion #1564. Those issues addressed .NET Framework
vs. .NET Core detection; this issue specifically addresses the solution folder workflow
where no .csproj is directly present.
oh-my-posh version: 26.25.0
OS: Windows 11
Shell: PowerShell 7.5.4
Terminal: Windows Terminal
Configuration
{
"type": "project",
"style": "powerline",
"foreground": "#1E1E2E",
"background": "#89B4FA",
"powerline_symbol": "\uE0B0",
"template": " {{ if .Error }}{{ else }}\uDB82\uDEAE {{ if .Target }}{{ .Target }}{{ else }}{{ .Version }}{{ end }} {{ end }}",
"properties": {
"always_enabled": false
}
}
Code of Conduct
What would you like to see changed?
Context
The
projectsegment correctly detects.slnfiles and shows the .NET icon, but does notdisplay any version information when working in a solution folder where only a
.slnfileis present (no
.csprojdirectly in the folder).This is the standard workflow for .NET developers: the
.slnfile lives at the repo root,while individual
.csprojfiles live in subdirectories. Git operations (git status,git push, etc.) are always performed from the solution folder, not from individualproject folders.
Current behavior
Given this folder structure:
When in
MyApp/, theprojectsegment shows the .NET icon but no version.Expected behavior
The segment should resolve the
TargetFrameworkof the startup/first project in thesolution and display it.
Proposed implementation
When the current directory contains a
.slnfile but no.csprojdirectly, the segmentshould search one level deeper (non-recursively to avoid performance impact) for
.csprojfiles and read the
TargetFrameworkelement from the first match.Alternatively, a new property
search_subdirectories(boolean, defaultfalse) couldopt in to this behavior explicitly, giving users control over performance vs. information
tradeoff.
Reference
This is related to the closed issue #1568 ("Enhance dotnet segment to support .Net
framework") and the associated discussion #1564. Those issues addressed
.NET Frameworkvs.
.NET Coredetection; this issue specifically addresses the solution folder workflowwhere no
.csprojis directly present.oh-my-posh version: 26.25.0
OS: Windows 11
Shell: PowerShell 7.5.4
Terminal: Windows Terminal
Configuration
{ "type": "project", "style": "powerline", "foreground": "#1E1E2E", "background": "#89B4FA", "powerline_symbol": "\uE0B0", "template": " {{ if .Error }}{{ else }}\uDB82\uDEAE {{ if .Target }}{{ .Target }}{{ else }}{{ .Version }}{{ end }} {{ end }}", "properties": { "always_enabled": false } }