Adding a C# library can silently restrict its reference to Debug builds
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 74/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Ambito
- build-system, cli
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Python
- Stelle
- 335
- Fork
- 172
- Merge medio
- 6h 54m
- PR unite (30g)
- 37
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
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 QuantConnect/lean-cli
-
priority:P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
QuantConnect/lean-cli#792 ·
I maintainer di solito rispondono entro 1 giorno
-
priority:P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
QuantConnect/lean-cli#786 ·
I maintainer di solito rispondono entro 1 giorno
-
priority:P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
QuantConnect/lean-cli#785 ·
I maintainer di solito rispondono entro 1 giorno
-
A partially written live command result aborts polling with JSONDecodeErrorForse già presa @pcbeingused333 l’ha presa 3 giorni fa. Apertapriority:P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
QuantConnect/lean-cli#784 ·
I maintainer di solito rispondono entro 1 giorno
-
Container lookup failures during result polling are masked by UnboundLocalErrorForse già presa @pcbeingused333 l’ha presa 5 giorni fa. Apertapriority:P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
QuantConnect/lean-cli#783 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di QuantConnect/lean-cli
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
I maintainer di solito rispondono entro 4 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
pimutils/vdirsyncer#1242 ·
-
backlog
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
sagemathinc/sagebrush#2768 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
vllm-project/vllm-ascend#23791 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
briandconnelly/context-audit#33 ·
I maintainer di solito rispondono entro 1 giorno