Name validation is stricter than VS and MSBuild
@richardstanton đang làm issue này rồi.
Từ ngày 4/6/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
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.
- Ngôn ngữ chính
- C#
- Star
- 213
- Fork
- 14
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/vs-solutionpersistence
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
microsoft/vs-solutionpersistence#73 · 2 bình luận ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 45/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
microsoft/vs-solutionpersistence#147 · 4 reaction ·
Tất cả issue của microsoft/vs-solutionpersistence
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
gavin-wolfe/wolfden#104 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] Still libmicrohttpd dependency is not removed properly from External-Dependency-Info.txt fileĐang mởtype/bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[辞書] かんそうりつ->乾燥率Đang mở辞書
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
thomhurst/TUnit#7201 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
ArduPilot/MissionPlanner#3826 ·
Maintainer thường phản hồi trong vòng 1 ngày