-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPack.ps1
More file actions
22 lines (17 loc) · 794 Bytes
/
Pack.ps1
File metadata and controls
22 lines (17 loc) · 794 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
param ([parameter(mandatory=$true)][string]$version)
# Split the version string by dots
$versionParts = $version.Split('.')
# Check if we have exactly 3 parts
if ($versionParts.Count -ne 3) {
Write-Error @"
Version must have exactly 3 parts (e.g., 1.2.27) for NuGet package versioning.
Why 3 parts are required:
- NuGet normalizes 4-part versions by dropping trailing zeros
- 1.2.27.0 becomes 1.2.27, causing package mismatch errors
- Semantic versioning (major.minor.patch) is the NuGet standard
Your version '$version' has $($versionParts.Count) parts.
Please provide a version in the format: major.minor.patch (e.g., 1.2.27)
"@
exit 1
}
dotnet pack -c Release -o ./nuget /p:PackageVersion=$version /p:AssemblyVersion=$version /p:AssemblyFileVersion=$version /p:CI=true