Skip to content

Commit ead5ee7

Browse files
committed
fix(ci): handle prerelease versions in AssemblyVersion
AssemblyVersion must be purely numeric (e.g., 1.0.0.0), but dev builds were passing semantic versions with prerelease suffixes (0.0.0-dev.xxx) which caused MC1005 build errors. - Add conditional logic in csproj to allow CI override of AssemblyVersion - Update ci.yml to pass explicit numeric version for dev builds - Bump version to 0.6.1
1 parent 6677e1e commit ead5ee7

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,23 +53,26 @@ jobs:
5353
run: |
5454
$shortSha = "${{ github.sha }}".Substring(0, 7)
5555
$version = "0.0.0-dev.$shortSha"
56+
# AssemblyVersion and FileVersion must be purely numeric
57+
$numericVersion = "0.0.0.0"
5658
echo "VERSION=$version" >> $env:GITHUB_OUTPUT
59+
echo "NUMERIC_VERSION=$numericVersion" >> $env:GITHUB_OUTPUT
5760
echo "SHORT_SHA=$shortSha" >> $env:GITHUB_OUTPUT
58-
echo "Dev version: $version"
61+
echo "Dev version: $version (numeric: $numericVersion)"
5962
6063
- name: Restore dependencies
6164
run: dotnet restore ${{ env.PROJECT_PATH }}
6265

6366
- name: Build Release
64-
run: dotnet build ${{ env.PROJECT_PATH }} -c Release --no-restore -p:Version=${{ steps.version.outputs.VERSION }}
67+
run: dotnet build ${{ env.PROJECT_PATH }} -c Release --no-restore -p:Version=${{ steps.version.outputs.VERSION }} -p:AssemblyVersion=${{ steps.version.outputs.NUMERIC_VERSION }} -p:FileVersion=${{ steps.version.outputs.NUMERIC_VERSION }}
6568

6669
- name: Publish win-x64 (framework-dependent)
6770
run: |
68-
dotnet publish ${{ env.PROJECT_PATH }} -c Release -r win-x64 --self-contained false -p:Version=${{ steps.version.outputs.VERSION }} -o src/SendspinClient/bin/publish/win-x64-framework
71+
dotnet publish ${{ env.PROJECT_PATH }} -c Release -r win-x64 --self-contained false -p:Version=${{ steps.version.outputs.VERSION }} -p:AssemblyVersion=${{ steps.version.outputs.NUMERIC_VERSION }} -p:FileVersion=${{ steps.version.outputs.NUMERIC_VERSION }} -o src/SendspinClient/bin/publish/win-x64-framework
6972
7073
- name: Publish win-x64 (self-contained)
7174
run: |
72-
dotnet publish ${{ env.PROJECT_PATH }} -c Release -r win-x64 --self-contained true -p:PublishSingleFile=false -p:PublishTrimmed=false -p:Version=${{ steps.version.outputs.VERSION }} -o src/SendspinClient/bin/publish/win-x64-selfcontained
75+
dotnet publish ${{ env.PROJECT_PATH }} -c Release -r win-x64 --self-contained true -p:PublishSingleFile=false -p:PublishTrimmed=false -p:Version=${{ steps.version.outputs.VERSION }} -p:AssemblyVersion=${{ steps.version.outputs.NUMERIC_VERSION }} -p:FileVersion=${{ steps.version.outputs.NUMERIC_VERSION }} -o src/SendspinClient/bin/publish/win-x64-selfcontained
7376
7477
# Sign the main application EXEs before creating installers
7578
- name: Sign Application EXEs (framework-dependent)

src/SendspinClient/SendspinClient.csproj

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,15 @@
1010
<ApplicationIcon>Resources\Icons\sendspinTray.ico</ApplicationIcon>
1111

1212
<!-- Version info - set via -p:Version= during CI builds -->
13-
<Version>0.6.0</Version>
14-
<!-- Derive other version properties from Version so CI override works -->
15-
<FileVersion>$(Version).0</FileVersion>
16-
<AssemblyVersion>$(Version).0</AssemblyVersion>
13+
<Version>0.6.1</Version>
14+
<!--
15+
AssemblyVersion/FileVersion must be purely numeric (major.minor.build.revision).
16+
For prerelease versions like "0.0.0-dev.xxx", we need separate numeric versions.
17+
CI should pass -p:AssemblyVersion= and -p:FileVersion= for prerelease builds.
18+
Default values here work for normal release builds (e.g., "0.6.0" -> "0.6.0.0").
19+
-->
20+
<AssemblyVersion Condition="'$(AssemblyVersion)' == ''">$(Version).0</AssemblyVersion>
21+
<FileVersion Condition="'$(FileVersion)' == ''">$(Version).0</FileVersion>
1722
<InformationalVersion>$(Version)</InformationalVersion>
1823
</PropertyGroup>
1924

0 commit comments

Comments
 (0)