csproj export emits embedded resources flat instead of restoring folder structure from dotted LogicalName
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
- #3735 của @OpenSourcereR-dev — đã đóng, không merge
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 58/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- csharp
- Lĩnh vực
- build-system, cli, tooling
Hướng nghiên cứu
Bắt đầu từ điểm vào xuất dự án của ilspycmd và tái hiện sự cố bằng ilspycmd MyApp.exe -p -o ./out. Theo dõi cách các mục EmbeddedResource và các giá trị LogicalName của chúng trở thành các tệp và mục csproj. Công việc được xem là hoàn tất khi các tên tài nguyên có dấu chấm được ánh xạ vào các thư mục mong đợi trong khi LogicalName vẫn không thay đổi, bao gồm các trường hợp dấu gạch dưới ở đầu và thư mục có dấu chấm đã được ghi lại.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
When exporting an assembly as a .csproj (ilspycmd <asm> -p), embedded
resources are written to disk as flat files in the project root with their
full dotted manifest names as the filenames, rather than being restored to a
folder hierarchy that matches what the original source tree probably looked
like. The dotted segments of the resource name encode exactly that hierarchy
(modulo SDK name-mangling rules).
Steps to reproduce
Take any assembly built from a project whose source tree organizes assets
into folders (e.g. images/CopyHS.png, payloads/9.01/payloadName.bin), then:
ilspycmd MyApp.exe -p -o ./out
Actual output
out/
├── MyApp.images.CopyHS.png
├── MyApp.images.CutHS.png
├── MyApp.images.donate_full.png
├── MyApp.payloads._9._01.payloadName.bin
└── MyApp.csproj
with corresponding csproj entries:
<None Remove="MyApp.images.CopyHS.png" />
<EmbeddedResource Include="MyApp.images.CopyHS.png"
LogicalName="MyApp.images.CopyHS.png" />
Expected output
out/
├── images/
│ ├── CopyHS.png
│ ├── CutHS.png
│ └── donate_full.png
├── payloads/
│ └── 9.01/
│ └── payloadName.bin
└── MyApp.csproj
with csproj entries that preserve the original logical name even though the
file now lives in a folder, so existing
Assembly.GetManifestResourceStream("MyApp.images.CopyHS.png") calls in the
decompiled code keep working unchanged:
<EmbeddedResource Include="images\CopyHS.png"
LogicalName="MyApp.images.CopyHS.png" />
Why this matters
Right now, opening the decompiled csproj in Visual Studio shows a project
root with dozens of dotted-name files all jumbled together at the top level.
Reorganizing them into the original folder layout is a purely mechanical
transform (the dot-separated logical name is the encoding of the original
path) but currently has to be done by hand for every decompiled project.
Proposed approach
For each EmbeddedResource whose logical name begins with the project's
root namespace (typically the assembly name), strip that prefix, split the
remainder on ., treat the last segment as the file extension, the
second-to-last as the filename stem, and the rest as folder segments.
Apply the inverse of the SDK's leading-_ mangling for segments that begin
with _<digit>. Preserve the original LogicalName= attribute on the
emitted item so the resource keys stay byte-identical and existing
reflection-based resource lookups in the decompiled code keep working.
There is one inherent ambiguity (a folder name like 9.01 round-trips to
_9._01 which is indistinguishable from a 9/01/ two-folder hierarchy
without external knowledge), but a heuristic that merges consecutive
underscore-digit segments into a single dotted folder name handles the
common case and is no worse than the current behavior for the others.
Details
- Product in use: ilspycmd
- Version in use: 10.0.0.8330 (latest stable as of 2026-04-13)
- Ngôn ngữ chính
- C#
- Star
- 27.1k
- Fork
- 3.8k
- Merge trung bình
- 1 ngày 23 giờ
- Pull request đã merge (30 ngày)
- 44
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- 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 icsharpcode/ILSpy
-
AvaloniaEdit Issues to dateĐang mởExternal UI
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 75/100
icsharpcode/ILSpy#4284 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
icsharpcode/ILSpy#4357 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Misdecompilation of a lazy initialization patternCó thể đã có người làm @siegfriedpammer đã nhận 5 ngày trước. Đang mởBug Decompiler
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 20/100
icsharpcode/ILSpy#4349 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
icsharpcode/ILSpy#4343 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
AI
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 55/100
icsharpcode/ILSpy#4300 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của icsharpcode/ILSpy
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
umbraco/Umbraco.Automate#612 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
崩溃日志只按 CRLF 分行Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
PCL-Community/PCL-CE#3872 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
type:task ux
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
elsa-workflows/elsa-foundation#5253 ·
Maintainer thường phản hồi trong vòng 1 ngày