Skip to content

Commit 27c74da

Browse files
committed
feat: Phase 5.5 wire meta-package to ship the analyzer as a dev-only NuGet
Pre-5.5 the Testably.Abstractions.Migration nupkg was a 7K placeholder DLL with no analyzer payload — installing it did nothing. Source/Testably.Abstractions.Migration/Testably.Abstractions.Migration.csproj now packs both analyzer DLLs into `analyzers/dotnet/cs/` so Roslyn auto- discovers them on install. Wiring uses ProjectReference with `ReferenceOutputAssembly="false" PrivateAssets="all"` to force the analyzer projects to build first without leaking their assemblies into lib/. Property envelope alignment via `SetTargetFramework="TargetFramework=netstandard2.0"` matches the test / playground projects' references. MSBuild's project graph keys nodes by the property envelope, so without the matching SetTargetFramework the meta-package's references would create a second graph node for each analyzer project — and on parallel CI builds both nodes race on the analyzer's deps.json, failing GenerateDepsFile with a "file in use" IOException. Marked as a dev-only tool via `DevelopmentDependency=true` so NuGet does not propagate the package as a transitive dependency of consumers (auto-applies PrivateAssets=all on the consumer side). The empty placeholder lib DLL is intentionally retained: it satisfies NuGet's NU5017 ("no content") check which is elevated to an error by `TreatWarningsAsErrors=true` and would otherwise fail the CI build when the only payload is an analyzer. The package intentionally does NOT add a PackageReference to Testably.Abstractions.Testing. The migration package is a one-shot tool (install → migrate → uninstall); pulling the target lib transitively would mask the missing reference until the user removes the migration package, at which point the migrated tests would stop compiling. Consumers must reference Testably.Abstractions.Testing themselves. Analyzer DLL paths use $(TargetFramework) so packaging tracks the central TFM (Source/Directory.Build.props), and PackagePath uses a trailing slash to match sibling Pack metadata in the codebase. Build still requires going through the .slnx so $(SolutionDir) resolves for the README pack target.
1 parent 570cabe commit 27c74da

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

Source/Testably.Abstractions.Migration/Testably.Abstractions.Migration.csproj

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,49 @@
22

33
<PropertyGroup>
44
<RootNamespace>Testably.Abstractions.Migration</RootNamespace>
5+
<!--
6+
This is a one-shot dev tool: install, run the migration, uninstall.
7+
DevelopmentDependency=true marks the package as dev-only so it does not
8+
propagate to the consumer's transitive dependencies and is auto-treated
9+
with PrivateAssets=all. Consumers must reference Testably.Abstractions.Testing
10+
themselves so the dependency survives the migration package's removal.
11+
The empty-placeholder lib DLL is intentionally left in place: it satisfies
12+
NuGet's "no content" check (NU5017) which would otherwise fail under
13+
TreatWarningsAsErrors when the only payload is an analyzer.
14+
-->
15+
<DevelopmentDependency>true</DevelopmentDependency>
516
</PropertyGroup>
617

18+
<!--
19+
The test / playground projects reference the same analyzer projects with
20+
`SetTargetFramework="TargetFramework=netstandard2.0"` (forcing the analyzer
21+
TFM when the consumer targets net10.0). MSBuild's project graph keys nodes
22+
by the property envelope, so omitting the same property here would create a
23+
second graph node for each analyzer project — and on parallel CI builds
24+
both nodes race on `bin/Release/netstandard2.0/*.deps.json`, failing
25+
GenerateDepsFile with a file-in-use error. Match the test-side envelope to
26+
dedupe to a single build.
27+
-->
28+
<ItemGroup>
29+
<ProjectReference Include="..\Testably.Abstractions.Migration.Analyzers\Testably.Abstractions.Migration.Analyzers.csproj"
30+
ReferenceOutputAssembly="false"
31+
PrivateAssets="all"
32+
SetTargetFramework="TargetFramework=netstandard2.0"/>
33+
<ProjectReference Include="..\Testably.Abstractions.Migration.Analyzers.CodeFixers\Testably.Abstractions.Migration.Analyzers.CodeFixers.csproj"
34+
ReferenceOutputAssembly="false"
35+
PrivateAssets="all"
36+
SetTargetFramework="TargetFramework=netstandard2.0"/>
37+
</ItemGroup>
38+
39+
<ItemGroup>
40+
<None Include="..\Testably.Abstractions.Migration.Analyzers\bin\$(Configuration)\$(TargetFramework)\Testably.Abstractions.Migration.Analyzers.dll"
41+
Pack="true"
42+
PackagePath="analyzers/dotnet/cs/"
43+
Visible="false"/>
44+
<None Include="..\Testably.Abstractions.Migration.Analyzers.CodeFixers\bin\$(Configuration)\$(TargetFramework)\Testably.Abstractions.Migration.Analyzers.CodeFixers.dll"
45+
Pack="true"
46+
PackagePath="analyzers/dotnet/cs/"
47+
Visible="false"/>
48+
</ItemGroup>
49+
750
</Project>

0 commit comments

Comments
 (0)