Adding a C# library can silently restrict its reference to Debug builds
Les mainteneurs répondent en général sous 1 jour
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 74/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Domaine
- build-system, cli
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- Python
- Étoiles
- 335
- Forks
- 172
- Merge moyen
- 6 h 54 min
- PR mergées (30 j)
- 37
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de QuantConnect/lean-cli
-
priority:P2
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
QuantConnect/lean-cli#792 ·
Les mainteneurs répondent en général sous 1 jour
-
priority:P2
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
QuantConnect/lean-cli#786 ·
Les mainteneurs répondent en général sous 1 jour
-
priority:P2
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
QuantConnect/lean-cli#785 ·
Les mainteneurs répondent en général sous 1 jour
-
A partially written live command result aborts polling with JSONDecodeErrorPeut-être pris @pcbeingused333 l’a pris il y a 3 jours. Ouvertepriority:P2
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
QuantConnect/lean-cli#784 ·
Les mainteneurs répondent en général sous 1 jour
-
Container lookup failures during result polling are masked by UnboundLocalErrorPeut-être pris @pcbeingused333 l’a pris il y a 5 jours. Ouvertepriority:P2
Difficulté 2/5 1-3 heures Accessibilité débutants 80/100
QuantConnect/lean-cli#783 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de QuantConnect/lean-cli
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 79/100
Les mainteneurs répondent en général sous 4 jours
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
pimutils/vdirsyncer#1242 ·
-
backlog
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
sagemathinc/sagebrush#2768 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
vllm-project/vllm-ascend#23791 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
briandconnelly/context-audit#33 ·
Les mainteneurs répondent en général sous 1 jour