Skip to content

Commit 0d5b364

Browse files
sunnamed434claude
andcommitted
Fix CI: don't pass a global TargetFramework to dotnet restore
The BITM0001 analyzer commit added a netstandard2.0-only BitMono.Analyzers ProjectReference to BitMono.Core and BitMono.Protections. The project-build action injected a global -p:TargetFramework into `dotnet restore` (empty for multi-TFM libraries, a concrete TFM for the CLI matrix). That global TF leaks into the single-target analyzer reference during restore and breaks it: empty TF -> NuGet "Invalid framework identifier ''" (Core/Host/Protections/ Obfuscation/GlobalTool) net9.0 -> NETSDK1005, analyzer assets lack netstandard2.0 (CLI/Build matrix) restore is a superset (it restores every TFM anyway), so drop the TargetFramework flag from restore; build/test still pass it. Verified locally: Core multi-TFM restore+build+nupkg and the CLI net9.0+runtime build both succeed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 4b05868 commit 0d5b364

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

.github/actions/project-build/action.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ runs:
6565
- name: Common commands
6666
id: common-commands
6767
run: |
68-
echo "dotnet-restore=dotnet restore \$PROJECT_PATH ${{ steps.set-runtime-flag.outputs.runtime }} -p:Configuration=Release -p:TargetFramework=${{ inputs.target_framework }}" >> $GITHUB_OUTPUT
68+
# TargetFramework is intentionally NOT passed to restore: restore is a superset (all TFMs anyway),
69+
# and a global TargetFramework (empty for multi-TFM libs, a concrete TFM for the CLI matrix) leaks
70+
# into the netstandard2.0-only BitMono.Analyzers ProjectReference and breaks restore ("Invalid
71+
# framework identifier ''") or the later build (NETSDK1005). Build/test below still pass it.
72+
echo "dotnet-restore=dotnet restore \$PROJECT_PATH ${{ steps.set-runtime-flag.outputs.runtime }} -p:Configuration=Release" >> $GITHUB_OUTPUT
6973
echo "dotnet-build=dotnet build \$PROJECT_PATH --configuration Release --no-restore ${{ steps.set-runtime-flag.outputs.runtime }} -p:TargetFramework=${{ inputs.target_framework }} -p:BitMonoVersion=${{ steps.get-version.outputs.version }}" >> $GITHUB_OUTPUT
7074
echo "dotnet-test=dotnet test \$PROJECT_PATH --configuration Release --no-restore --no-build ${{ steps.set-runtime-flag.outputs.runtime }} -p:TargetFramework=${{ inputs.target_framework }}" >> $GITHUB_OUTPUT
7175
shell: bash

0 commit comments

Comments
 (0)