Name validation is stricter than VS and MSBuild
@richardstanton ci sta già lavorando.
Dal 4/6/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Parsing a valid .sln file with a solution folder named CI/CD throws SolutionException because ValidateName rejects the / character. More broadly, the library rejects / ? : * " < > | and DOS reserved names (CON, AUX, LPT4, etc.) in folder names, project names, and configuration names — even though these are filesystem concerns that don't apply to display names stored in .sln files.
How other parsers handle this
We surveyed two other .sln parsers to understand established behavior:
VS's original parser (src/env/vscore/package/Solutions/SolutionPersistence.cs):
- Display names: no character validation at all during read. On write, project names are truncated at the first
\r,\n, or\t— that's the only sanitization. - No reserved name checks (CON, AUX, etc.).
- Solution folder names are treated as plain display strings with no special validation.
MSBuild's parser (src/Build/Construction/Solution/SolutionFile.cs):
- Display names: zero character validation.
ParseFirstProjectLineregex-extracts the name and assigns it directly. Empty names get a synthesized placeholder; that's the only special handling. - Project relative paths: validated against
Path.GetInvalidPathChars()(control characters only), notGetInvalidFileNameChars(). - Configuration names: only structural validation —
BuildType|Platformmust split into exactly two parts on|. No character validation on the individual parts. - When names need to become MSBuild XML identifiers,
MakeIntoSafeItemNameandCleanseProjectNametransform invalid characters to_rather than rejecting them. - No reserved name checks.
This library (Microsoft.VisualStudio.SolutionPersistence):
ValidateName(used for solution folder names only — viaCreateFolder,AddFolder, and theNamesetter) rejects/ ? : \ * " < > |, control characters, DOS reserved names,.,.., and names over 260 characters.- The same validation is shared for configuration names (
AddBuildType,AddPlatform). - Project display names are not validated by
ValidateName— they only get duplicate-name checking.
Summary
| Concern | VS original | MSBuild | This library |
|---|---|---|---|
/ ? : * " < > | in display names |
Allowed | Allowed | Rejected |
\ (backslash) in display names |
Allowed | Allowed | Rejected |
| DOS reserved names (CON, AUX, etc.) | Allowed | Allowed | Rejected |
. and .. as names |
Allowed | Allowed | Rejected |
| Control characters | Stripped on write | Rejected in paths only | Rejected |
| Configuration name characters | No validation | Only | split must yield 2 parts |
Rejected: / ? : \ * " < > | |
The key principle in both VS and MSBuild is that display names are arbitrary strings, not filesystem paths. Filesystem-invalid characters and reserved names are only relevant when a name maps to something on disk (like a project's relative path), not for logical names like solution folders or build configurations.
Considerations
ValidateName is only called for solution folder names — the one type of name that is purely virtual and never touches the filesystem. Ironically, project display names (which do derive from filesystem paths) skip this validation entirely.
The \ restriction is the one character that has a structural justification in this library's model, since the folder path format (/Folder/Subfolder/) normalizes backslashes. The / restriction is also structurally motivated for configuration names, since it's the folder-path segment delimiter, and | is the BuildType|Platform separator.
The remaining restrictions (? : * " < >, DOS reserved names, ./..) have no structural justification in the model — they are carried over from filesystem naming rules that don't apply to display names.
- Lingua principale
- C#
- Stelle
- 213
- Fork
- 14
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di microsoft/vs-solutionpersistence
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
microsoft/vs-solutionpersistence#73 · 2 commenti ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 45/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
microsoft/vs-solutionpersistence#147 · 4 reazioni ·
Tutte le issue di microsoft/vs-solutionpersistence
Issue simili
-
[i18n] 安装实例完成后的成功提示未正确本地化Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
PCL-Community/PCL-CE#3658 ·
I maintainer di solito rispondono entro 1 giorno
-
Deploy & Patch-issues opprettes ikke: create-pnd-issues.yml har feilet hver uke siden 2025-09-08Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
Altinn/altinn-auth#4359 ·
I maintainer di solito rispondono entro 1 giorno
-
type/automation type/tech-debt
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
High-DPI fixes for release/1.3: editor toolbar icons and Color Picker layout (patch included)Apertano-stack-trace
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
I maintainer di solito rispondono entro 1 giorno
-
S: Untriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
project-wayfarer/wayfarer-14#1650 ·
I maintainer di solito rispondono entro 2 giorni