- Clone and open
Acad-TotalLength.slnin Visual Studio 2022. - Make sure the AutoCAD release(s) you want to target are installed.
- Edit code under src/Shared/ — almost nothing should need to change in the per-version csprojs.
- Build with build.bat or
msbuild Acad-TotalLength.sln. - Smoke-test with
NETLOAD+ZLenin AutoCAD.
| Layer | Folder | Rules |
|---|---|---|
| AutoCAD entry points | src/Shared/ (root) |
Classes with IExtensionApplication or [CommandMethod]. Keep thin. |
| AutoCAD interaction | src/Shared/Application/ |
Anything that touches Editor, Database, Transaction. |
| Domain types | src/Shared/Core/ |
POCOs / value objects. No AutoCAD dependencies. |
| WPF | src/Shared/Presentation/ |
Views, view-models, value converters. No [CommandMethod] types here. |
| MVVM glue | src/Shared/Common/ |
Cross-cutting helpers (RelayCommand, etc.). |
- File-scoped namespaces.
<LangVersion>latest</LangVersion>and<Nullable>enable</Nullable>are on; new files should be nullable-clean.- Prefer
usingdeclarations overusingblocks where the lifetime is obvious. - Wrap any code that reads/writes
DBObjects inusing (var trans = ... StartTransaction()). Always commit at the end. - AutoCAD APIs are not thread-safe — never touch them off the main thread.
- Create the csproj. Copy
src\TotalLength 2026\TotalLength 2026.csproj(or the 2024 csproj if the new release still uses .NET Framework) tosrc\TotalLength <YYYY>\TotalLength <YYYY>.csproj. Update:<TargetFramework>(e.g.net10.0-windowsfor 2027).- All
HintPaths to point toC:\Program Files\Autodesk\AutoCAD <YYYY>\.
- Register in the .sln. Add three sections to
Acad-TotalLength.sln:- A
Project(...) = "TotalLength <YYYY>", "src\TotalLength <YYYY>\TotalLength <YYYY>.csproj", "{NEW-GUID}"block. Use a freshly generated GUID ([guid]::NewGuid()in PowerShell). - Four
ProjectConfigurationPlatformsentries for the new GUID (Debug/Release × ActiveCfg/Build.0), mirroring an existing target. - One
SharedMSBuildProjectFilesentry:src\Shared\Shared.projitems*{new-guid-lowercase}*SharedItemsImports = 5(= 5for SDK-style;= 4for old-style).
- A
- Update build.bat. Add a
call :build <YYYY> ...line. - Update docs/build-and-load.md and the README badge.
- Add the class under
src/Shared/Commands/(or another logical folder). - Decorate the public method with
[CommandMethod("YourCommandName")]. - Make sure the file is included by
Shared.projitems— this happens automatically if you add the file via Visual Studio with the Shared project active. - Rebuild and test with
NETLOAD.
Edit RibbonManager.cs. Use existing buttons as a template — the gotcha is that pack URIs reference the assembly name (codehaks.TotalLength), not the namespace.
- Builds clean for all three AutoCAD versions (
build.bat Releasesucceeds). - Smoke-tested in at least one AutoCAD release.
- No new
#if DEBUG-only code on user-visible paths. -
MainViewModelproperties raiseOnPropertyChanged(). - AutoCAD work happens inside a transaction.
- Tests added/updated for new logic (see testing.md).