自动获取版本号,从文件版本号获取
This commit is contained in:
@@ -10,7 +10,25 @@ $targetDllName = "JoyD.Windows.CS.Utils.dll" # 保持与AssemblyName一致,
|
||||
|
||||
# NuGet包元数据配置 - 在此处修改所有元数据
|
||||
$packageId = "com.joyd.utils"
|
||||
$version = "1.0.0.0" # 更新版本号以确保用户安装的是修复后的版本
|
||||
|
||||
# 从AssemblyInfo.cs的AssemblyFileVersion获取版本号
|
||||
$assemblyInfoPath = Join-Path $scriptDir "Utils\Properties\AssemblyInfo.cs"
|
||||
if (Test-Path $assemblyInfoPath) {
|
||||
$assemblyInfoContent = Get-Content -Path $assemblyInfoPath -Encoding UTF8 -Raw
|
||||
|
||||
# 只从AssemblyFileVersion获取版本号
|
||||
$fileVersionMatch = [regex]::Match($assemblyInfoContent, '(?<!//)\[assembly: AssemblyFileVersion\("(.*?)"\)\]')
|
||||
if ($fileVersionMatch.Success) {
|
||||
$version = $fileVersionMatch.Groups[1].Value
|
||||
Write-Host "从AssemblyFileVersion获取到版本号: $version"
|
||||
} else {
|
||||
Write-Host "错误: 无法从AssemblyInfo.cs的AssemblyFileVersion中获取版本号" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
} else {
|
||||
Write-Host "错误: 找不到AssemblyInfo.cs文件" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
$title = "通用工具库"
|
||||
$authors = "曾庆明"
|
||||
$owners = "JoyD Technology"
|
||||
|
||||
Reference in New Issue
Block a user