Adding a C# library can silently restrict its reference to Debug builds
維護者通常 1 天內回覆
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 74/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 領域
- build-system, cli
研究方向
Start in lean/commands/library/add.py and inspect _add_csharp_project_to_csproj and _add_csharp_package_to_csproj, which the issue identifies as sharing the conditional last-ItemGroup behavior. Trace their existing tests and add regression coverage for a project whose last or only ItemGroup is conditional. Done means both added references are available in Debug and Release builds.
由索引模型根據 Issue 內容生成。
描述
Problem
Adding a C# library can silently make its reference available only in Debug builds. The reference is appended to the last ItemGroup, even when that group has a configuration condition. The command succeeds and records the library in config.json, but Release builds cannot use it.
The reference-writing helper has this behavior on master at 51a654f.
Reproduction
-
In an initialized Lean CLI workspace, have a C# project
Appand C# libraryLibrary/Lib. A minimalApp/App.csprojis:<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>net10.0</TargetFramework> </PropertyGroup> <ItemGroup Condition="'$(Configuration)' == 'Debug'" /> </Project> -
Define
ExampleLibrary.UsefulTypein the library and use that type in the application. -
Run
lean library add App Library/Lib --no-local.
The command exits successfully but inserts this reference inside the Debug-only group:
<ItemGroup Condition="'$(Configuration)' == 'Debug'">
<ProjectReference Include="../Library/Lib/Lib.csproj" />
</ItemGroup>
dotnet build App/App.csproj -c Debugsucceeds;dotnet build App/App.csproj -c Releasefails withCS0246forExampleLibrary.
Verified through the library command and actual Debug/Release builds, and independently with _add_csharp_project_to_csproj loaded from the base commit above. _add_csharp_package_to_csproj in lean/commands/library/add.py uses the same last-group selection; directly adding a package also puts its PackageReference into the conditional group.
Expected result
Adding a library or package without a configuration restriction should make the new reference available in every build configuration. Regression tests should cover a project whose last or only ItemGroup is conditional.
Suggestion: share the group-selection/insertion logic between project and package references, selecting or creating an unconditional group rather than inheriting an unrelated group's condition.
Impact is limited to customized project files with conditional groups. Moving the new reference to an unconditional group is a workaround.
- 主要語言
- Python
- 星號
- 335
- 分支
- 172
- 平均合併
- 6 小時 54 分鐘
- 30 天內合併 PR
- 37
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
QuantConnect/lean-cli 的其他 Issue
-
priority:P2
難度 2/5 1-3 小時 新手友好度 75/100
QuantConnect/lean-cli#792 ·
維護者通常 1 天內回覆
-
priority:P2
難度 2/5 1-3 小時 新手友好度 74/100
QuantConnect/lean-cli#786 ·
維護者通常 1 天內回覆
-
priority:P2
難度 2/5 1-3 小時 新手友好度 72/100
QuantConnect/lean-cli#785 ·
維護者通常 1 天內回覆
-
A partially written live command result aborts polling with JSONDecodeError可能已有人在做 @pcbeingused333 於 3 天前認領。 未關閉priority:P2
難度 2/5 1-3 小時 新手友好度 72/100
QuantConnect/lean-cli#784 ·
維護者通常 1 天內回覆
-
Container lookup failures during result polling are masked by UnboundLocalError可能已有人在做 @pcbeingused333 於 5 天前認領。 未關閉priority:P2
難度 2/5 1-3 小時 新手友好度 80/100
QuantConnect/lean-cli#783 ·
維護者通常 1 天內回覆
查看 QuantConnect/lean-cli 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 79/100
維護者通常 4 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
pimutils/vdirsyncer#1242 ·
-
backlog
難度 2/5 1-3 小時 新手友好度 78/100
sagemathinc/sagebrush#2768 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 82/100
vllm-project/vllm-ascend#23791 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 78/100
briandconnelly/context-audit#33 ·
維護者通常 1 天內回覆