Skip to content

Commit a863f87

Browse files
fix(pack): analyzer DLL path on clean machines
`mur pack-local` was failing on a freshly-cloned machine with: NuGet.Build.Tasks.Pack.targets(222,5): error Could not find a part of the path '...\src\Reactor.Analyzers\bin\Debug\netstandard2.0\' Root cause: Reactor.csproj packs the analyzer + localization-generator DLLs into the framework nupkg via `<None Include>` paths that hardcode `bin\$(Configuration)\netstandard2.0\` — no `$(Platform)` segment. The two projects are also `<ProjectReference>`s, so when `dotnet pack` is invoked with `-p:Platform=x64` (or ARM64) the inherited Platform cascades to the transitive analyzer build and the output actually lands at `bin\x64\Debug\netstandard2.0\`. Pack then looks at the platform-less path, doesn't find the file, and fails. The bug was masked on dev machines by any prior AnyCPU build (VS solution, bare `dotnet build src/Reactor.Analyzers`, etc.) that left a stale DLL at the platform-less path. Fix: set `AppendPlatformToOutputPath=false` on both analyzer csprojs. These are netstandard2.0 IL with no platform-specific code, so output should always land at `bin\$(Configuration)\netstandard2.0\` regardless of what Platform the parent pack invocation inherited. Reproduced + verified locally with a wiped bin/obj tree. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 99d4b1d commit a863f87

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

src/Reactor.Analyzers/Reactor.Analyzers.csproj

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@
1212
<!-- Bundled into Microsoft.UI.Reactor.nupkg — does not ship as its own
1313
package. See docs/specs/022-packaging-and-distribution.md §5. -->
1414
<IsPackable>false</IsPackable>
15+
16+
<!-- Analyzers are platform-independent netstandard2.0 IL. Without this,
17+
when Reactor.csproj is packed with `-p:Platform=x64` (or ARM64) the
18+
inherited Platform cascades into this transitive build and the
19+
output lands at bin\x64\Debug\netstandard2.0\ — but Reactor.csproj's
20+
<None Include="...\bin\$(Configuration)\netstandard2.0\..."> for
21+
packing the analyzer DLL has no $(Platform) segment and breaks pack
22+
on a clean machine (no prior AnyCPU build to fall back to).
23+
AppendPlatformToOutputPath=false pins us to bin\$(Configuration)\
24+
regardless of inherited Platform. -->
25+
<AppendPlatformToOutputPath>false</AppendPlatformToOutputPath>
1526
</PropertyGroup>
1627

1728
<ItemGroup>

src/Reactor.Localization.Generator/Reactor.Localization.Generator.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
<IsRoslynComponent>true</IsRoslynComponent>
1010
<RootNamespace>Microsoft.UI.Reactor.Localization.Generator</RootNamespace>
1111
<AssemblyName>Reactor.Localization.Generator</AssemblyName>
12+
13+
<!-- See Reactor.Analyzers.csproj for the full rationale: Reactor.csproj's
14+
<None Include="...\bin\$(Configuration)\netstandard2.0\..."> pack
15+
glob has no $(Platform) segment, so this transitive source-generator
16+
build must not append the inherited Platform to its OutputPath. -->
17+
<AppendPlatformToOutputPath>false</AppendPlatformToOutputPath>
1218
</PropertyGroup>
1319

1420
<ItemGroup>

0 commit comments

Comments
 (0)