[Feature request, dotnet-codegencs] Be able to reuse code for templates
還沒有人認領這個 Issue。
評估
研究方向
先閱讀 dotnet-codegencs 進入點以及 issue 中提到的 TemplateBuilder 和 TemplateLoader 類別,然後追蹤 .csx 範本及其 #r 參考的處理方式。比較所要求的重用選項—#load、多個範本和本機 DLL 參考—並將「完成」定義為提供一種受支援的方式來共用範本邏輯,而不必在範本之間複製它。
由索引模型根據 Issue 內容生成。
描述
Hi!
First of all, thank you very much for the tool! It is easy to use, it's simple and it keeps saving a lot of time for our team.
Second, I need an advice on how to to reuse code for templates while keeping "text template + codegen tool" approach. We do use dotnet-codegencs tool to scaffold boilerplate code for our projects. Something like dotnet new but with some logic involved. It will be nice to be able to reuse basic logic and do not copypaste it across csx templates.
What I have tried so far
Use #load directive
Sadly, this option is not supported. The TemplateBuilder supports only #r directives.
Pass multiple templates as args to the dotnet-codegencs tool
Not supported, there currently can be only one template
reference local dll (not nuget package)
#r "ScaffoldHelpers.dll"
...
or
dotnet-codegencs template run .\TestTemplate.csx -r .\ScaffoldHelpers.dll
Fail with
Unhandled exception: System.TypeInitializationException: The type initializer for 'TestTemplate' threw an exception.
---> System.IO.FileNotFoundException: Could not load file or assembly 'ScaffoldHelpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
the reason is that referenced assemblies are not copied into the build directory and are not loaded by TemplateLoader.
Write custom runner using TemplateBuilder / TemplateLoader classes
Sadly, these are not distributed as a nuget packages, only as a part of dotnet-codegencs tool
Fork the dotnet-codegencs
We are currently using custom fork but it looks like a hack, I'd prefer to keep using original tool:)
Thanks in advance, hope you have a good Holidays!
- 主要語言
- C#
- 星號
- 309
- 分支
- 40
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
Drizin/CodegenCS 的其他 Issue
-
難度 3/5 1-2 天 新手友好度 45/100
-
bug help wanted
難度 3/5 1-2 天 新手友好度 45/100
-
Postgres support未關閉good first issue help wanted
難度 5/5 一週以上 新手友好度 20/100
相似的 Issue
-
The test-platform skill doesn't say what three of its failures look like可能已有人在做 @yasmoradi 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 68/100
bitfoundation/bitplatform#14022 ·
維護者通常 1 天內回覆
-
area-TableView bug needs-triage team-Controls
難度 2/5 1-3 小時 新手友好度 66/100
microsoft/microsoft-ui-xaml#12351 · 1 則留言 ·
維護者通常 2 天內回覆
-
AudioClient and ImageClient file path overloads send the full local path as the multipart file name可能已有人在做 @sebxt 今天認領。 未關閉area: audio area: images feature-request
難度 2/5 1-3 小時 新手友好度 76/100
openai/openai-dotnet#1453 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 73/100
維護者通常 1 天內回覆
-
Runtime diagnostics settings report canManage=true for every caller可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉needs-triage
難度 2/5 1-3 小時 新手友好度 78/100
elsa-workflows/elsa-foundation#3130 ·
維護者通常 1 天內回覆