@@ -6,19 +6,37 @@ via `netreg.exe`.
66
77- ** Framework:** .NET Framework 4.8, C# 10, Nullable enabled
88- ** Solution:** ` NtoLib.sln ` — two projects: ` NtoLib ` (main library) and ` Tests ` (xUnit)
9- - ** csproj style:** Old-style with explicit ` <Compile Include> ` entries (no wildcards)
9+ - ** csproj style:** SDK-style (` <Project Sdk="Microsoft.NET.Sdk"> ` ) with explicit
10+ ` <Compile Include> ` entries — default item globs are disabled
11+ (` EnableDefaultCompileItems=false ` , ` EnableDefaultEmbeddedResourceItems=false ` ,
12+ ` EnableDefaultNoneItems=false ` ) so the "no wildcards" rule still holds.
13+ - ** NuGet:** ` PackageReference ` only; versions centrally managed in
14+ ` Directory.Packages.props ` at the repo root (Central Package Management).
1015
1116## Build
1217
1318``` powershell
14- dotnet build NtoLib.sln
15- Build/Package.ps1 # build + ILRepack merge + archive
16- Build/Deploy.ps1 # build + merge + copy to target machine
19+ dotnet build NtoLib.sln # un-merged DLL (used by tests)
20+ dotnet build NtoLib.sln -p:RunILRepack=true # merged DLL (used for deployment)
21+ Build/Package.ps1 # build + test + ILRepack merge + archive
22+ Build/deploy.ps1 # build + merge + copy to target machine
1723```
1824
25+ ` Build/Package.ps1 ` orchestrates the pipeline: it runs the test suite against the
26+ un-merged DLL, then re-builds with ` -p:RunILRepack=true ` to produce the merged
27+ artifact, then archives.
28+
1929ILRepack merges all NuGet DLLs into a single ` NtoLib.dll ` , excluding vendor SDK DLLs
20- (` FB.dll ` , ` InSAT.* ` , ` MasterSCADA.* ` ). After build, ` netreg.exe NtoLib.dll /showerror `
21- registers the COM component for MasterSCADA.
30+ (` FB.dll ` , ` InSAT.* ` , ` MasterSCADA.* ` ). The merge step is implemented in
31+ ` NtoLib/ILRepack.targets ` (invoked through MSBuild via the
32+ ` ILRepack.Lib.MSBuild.Task ` package); the legacy ` Build/tools/Merge.ps1 ` PowerShell
33+ wrapper has been removed. The target is gated on the ` RunILRepack ` MSBuild
34+ property so a plain ` dotnet build ` produces an un-merged DLL — this is intentional
35+ and required, because ` NtoLib ` carries ` [InternalsVisibleTo("Tests")] ` and merging
36+ internalised NuGet types into the assembly would collide with the Tests project's
37+ own ` <PackageReference> ` s on the same packages (CS0433 ambiguity on
38+ ` FluentResults.Result<> ` , ` Microsoft.Extensions.* ` , etc.). After the merged build,
39+ ` netreg.exe NtoLib.dll /showerror ` registers the COM component for MasterSCADA.
2240
2341## Test
2442
@@ -46,7 +64,7 @@ Code Cleanup or `jb cleanupcode`.
4664NtoLib/
4765├── NtoLib/ main library (FB implementations)
4866├── Tests/ xUnit + FluentAssertions + Moq
49- ├── Build/ PowerShell pipeline (Package.ps1, Deploy .ps1, tools/)
67+ ├── Build/ PowerShell pipeline (Package.ps1, deploy .ps1, tools/)
5068├── Docs/ documentation
5169│ ├── architecture/ primer + NtoLib patterns (LLM-targeted, not user-facing)
5270│ ├── known_issues/ platform-level bug classes with cause and workaround
@@ -72,14 +90,46 @@ for the reading order).
7290
7391## csproj Conventions
7492
75- - ` NtoLib.csproj ` uses ** explicit ` <Compile Include> ` entries** — no wildcards. Every new
76- ` .cs ` file must be added manually.
93+ - ` NtoLib.csproj ` is ** SDK-style** (` <Project Sdk="Microsoft.NET.Sdk"> ` ) but uses
94+ ** explicit ` <Compile Include> ` entries** — no wildcards. Default item globs are
95+ disabled via ` EnableDefaultCompileItems=false ` ,
96+ ` EnableDefaultEmbeddedResourceItems=false ` , ` EnableDefaultNoneItems=false ` , and
97+ ` GenerateAssemblyInfo=false ` . Every new ` .cs ` file must be added manually.
7798- FB XML pin configuration files must be included as ** ` <EmbeddedResource> ` ** , not ` <Content> ` :
7899 ``` xml
79100 <EmbeddedResource Include =" MyFeature\MyFB.xml" />
80101 ```
81102- When adding a new FB with multiple source files, add all ` <Compile Include> ` and the
82103 ` <EmbeddedResource> ` entry in a single csproj edit to avoid partial builds.
104+ - ` packages.config ` is ** gone** — the project uses ` <PackageReference> ` exclusively.
105+
106+ ### Central Package Management
107+
108+ - NuGet package versions are centrally managed in ` Directory.Packages.props ` at the
109+ repo root (` ManagePackageVersionsCentrally=true ` ,
110+ ` CentralPackageTransitivePinningEnabled=true ` ).
111+ - Add a new package by appending a ` <PackageVersion Include="..." Version="..." /> `
112+ entry to ` Directory.Packages.props ` , then reference it from the consuming csproj
113+ with ` <PackageReference Include="..." /> ` — ** no ` Version= ` attribute on the
114+ ` PackageReference ` ** . NuGet emits ` NU1008 ` (hard error) if a ` Version= ` attribute
115+ is left in place under CPM, and ` NU1010 ` if a referenced id has no
116+ ` <PackageVersion> ` entry.
117+ - Dependabot is configured against the repo root and bumps versions in
118+ ` Directory.Packages.props ` only; csproj files are not touched by version updates.
119+
120+ ### ILRepack and ` [InternalsVisibleTo("Tests")] `
121+
122+ - The merge target lives in ` NtoLib/ILRepack.targets ` and is wired in via the
123+ ` ILRepack.Lib.MSBuild.Task ` package's ` $(ILRepackTargetsFile) ` hook.
124+ - The target only runs when the ` RunILRepack ` MSBuild property is ` true ` . A plain
125+ ` dotnet build ` therefore produces an ** un-merged** DLL — this is required for the
126+ Tests project to build, because merging internalises NuGet types that Tests also
127+ references directly.
128+ - ` Build/Package.ps1 ` runs the test suite against the un-merged DLL first, then
129+ re-invokes ` dotnet build NtoLib/NtoLib.csproj -c Release -p:RunILRepack=true ` to
130+ produce the deployable merged artifact between the Test and Archive steps.
131+ - ` Build/tools/Merge.ps1 ` no longer exists; do not re-introduce a PowerShell merge
132+ wrapper.
83133
84134## Dependencies
85135
0 commit comments