Skip to content

Commit 14aca2c

Browse files
authored
fix(build): unblock 1.39.0 Release packages build (NETSDK1047 in JsonRpc source generator) (#12341)
fix(build): keep RPC JSON source generator portable in self-contained RID publish scripts/build/build.sh publishes with -r <rid> --sc; those CLI global properties (RuntimeIdentifier, SelfContained, PublishSingleFile, IncludeAllContentForSelfExtract) leak into the RID-less Nethermind.JsonRpc.SourceGenerator[.Build] tool builds, which then fail with NETSDK1047 (no net10.0/<rid> target in project.assets.json). First hit on the 1.39.0 Release run: the packages path had not executed since #11697 introduced the generator (1.38.1 predates it). The Docker image path is unaffected because it publishes framework-dependent without -r. Fix: strip those properties from the generator ProjectReferences (UndefineProperties + GlobalPropertiesToRemove) and from the inner <MSBuild> invocations (RemoveProperties) so the tool always builds and runs as a portable framework-dependent app - required anyway for the cross-RID legs (win/osx) where the generator must execute on the Linux build host. Verified in the CI SDK container (10.0.301-resolute): pristine tree reproduces NETSDK1047 on 'publish -r linux-x64 --sc'; patched tree publishes successfully and the produced binary runs.
1 parent 9eff0d2 commit 14aca2c

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/Nethermind/Directory.Build.targets

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
</ItemGroup>
1818

1919
<ItemGroup Condition="'$(GenerateRpcJsonContext)' == 'true'">
20-
<ProjectReference Include="$(MSBuildThisFileDirectory)Nethermind.JsonRpc.SourceGenerator\Nethermind.JsonRpc.SourceGenerator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="all" GlobalPropertiesToRemove="GenerateRpcJsonContext" />
21-
<ProjectReference Include="$(MSBuildThisFileDirectory)Nethermind.JsonRpc.SourceGenerator.Build\Nethermind.JsonRpc.SourceGenerator.Build.csproj" ReferenceOutputAssembly="false" PrivateAssets="all" GlobalPropertiesToRemove="GenerateRpcJsonContext" />
20+
<ProjectReference Include="$(MSBuildThisFileDirectory)Nethermind.JsonRpc.SourceGenerator\Nethermind.JsonRpc.SourceGenerator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="all" GlobalPropertiesToRemove="GenerateRpcJsonContext;RuntimeIdentifier;SelfContained;PublishSingleFile;IncludeAllContentForSelfExtract" UndefineProperties="RuntimeIdentifier;SelfContained;PublishSingleFile;IncludeAllContentForSelfExtract" />
21+
<ProjectReference Include="$(MSBuildThisFileDirectory)Nethermind.JsonRpc.SourceGenerator.Build\Nethermind.JsonRpc.SourceGenerator.Build.csproj" ReferenceOutputAssembly="false" PrivateAssets="all" GlobalPropertiesToRemove="GenerateRpcJsonContext;RuntimeIdentifier;SelfContained;PublishSingleFile;IncludeAllContentForSelfExtract" UndefineProperties="RuntimeIdentifier;SelfContained;PublishSingleFile;IncludeAllContentForSelfExtract" />
2222
</ItemGroup>
2323

2424
<Target Name="_GenerateRpcJsonSerializerContext"
@@ -42,13 +42,15 @@
4242
<MSBuild Projects="$(_RpcJsonContextGeneratorProject)"
4343
Targets="GetTargetPath"
4444
Properties="Configuration=$(_RpcJsonContextGeneratorConfiguration);GenerateRpcJsonContext=false"
45+
RemoveProperties="RuntimeIdentifier;SelfContained;PublishSingleFile;IncludeAllContentForSelfExtract"
4546
BuildInParallel="false">
4647
<Output TaskParameter="TargetOutputs" PropertyName="_RpcJsonContextGeneratorPath" />
4748
</MSBuild>
4849

4950
<MSBuild Projects="$(_RpcJsonContextGeneratorProject)"
5051
Targets="Build"
5152
Properties="Configuration=$(_RpcJsonContextGeneratorConfiguration);GenerateRpcJsonContext=false"
53+
RemoveProperties="RuntimeIdentifier;SelfContained;PublishSingleFile;IncludeAllContentForSelfExtract"
5254
BuildInParallel="false"
5355
Condition="!Exists('$(_RpcJsonContextGeneratorPath)')" />
5456

0 commit comments

Comments
 (0)