解决乱码问题

This commit is contained in:
zqm
2025-10-23 16:32:27 +08:00
parent 00ecfe3a97
commit 3326b419ec
3 changed files with 73 additions and 18 deletions

View File

@@ -1,14 +1,28 @@
# 托普瑞控制库发布脚本 请在 chcp 65001下运行
# 配置参数
# 配置参数 - 基本设置
$scriptDir = Get-Location
$output = Join-Path $scriptDir "Output"
$server = "http://47.111.181.23:8081/repository/nuget-releases/"
$key = "admin:admin"
$packageId = "com.joyd.toprie"
$version = "1.0.0.0"
$actualDllName = "JoyD.Windows.CS.Toprie.dll"
$targetDllName = "Toprie.dll"
# NuGet包元数据配置 - 在此处修改所有元数据
$packageId = "com.joyd.toprie"
$version = "1.0.0.0"
$title = "托普瑞热像仪控制库"
$authors = "曾庆明"
$owners = "JoyD Technology"
$description = "托普瑞热像仪控制库,提供热像仪设备的连接、配置和数据获取功能"
$copyright = "Copyright 2025 JoyD Technology"
$tags = @("thermal", "camera", "toprie", "红外", "热像仪", "控制")
$projectUrl = "https://github.com/joyd/toprie-library"
$licenseUrl = "https://opensource.org/licenses/MIT"
$iconUrl = "https://example.com/icon.png"
$releaseNotes = "初始版本发布"
# 其他设置
$nupkgFileName = "$packageId.$version.nupkg"
$nupkgFilePath = Join-Path $output $nupkgFileName
@@ -90,10 +104,16 @@ $tempProjContent = @"
<TargetFramework>net40</TargetFramework>
<PackageId>$packageId</PackageId>
<Version>$version</Version>
<Title>Toprie Thermal Camera Control</Title>
<Authors>JoyD</Authors>
<Description>Thermal camera control library</Description>
<Copyright>Copyright 2025</Copyright>
<Title>$title</Title>
<Authors>$authors</Authors>
<Owners>$owners</Owners>
<Description>$description</Description>
<Copyright>$copyright</Copyright>
<PackageTags>$tagsString</PackageTags>
<PackageProjectUrl>$projectUrl</PackageProjectUrl>
<PackageLicenseUrl>$licenseUrl</PackageLicenseUrl>
<PackageIconUrl>$iconUrl</PackageIconUrl>
<PackageReleaseNotes>$releaseNotes</PackageReleaseNotes>
<PackageOutputPath>.</PackageOutputPath>
<RestorePackagesConfig>true</RestorePackagesConfig>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
@@ -112,18 +132,35 @@ Set-Content -Path $tempProjPath -Value $tempProjContent
# 在输出目录中创建包结构
Write-Host "3. 创建NuGet包.."
# 在输出目录中创建简化的nuspec文件
# 在输出目录中创建完整的nuspec文件
$nuspecPath = Join-Path $output "$packageId.nuspec"
# 将tags数组转换为空格分隔的字符串
$tagsString = $tags -join " "
$nuspecContent = @"
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>$packageId</id>
<version>$version</version>
<title>Toprie Thermal Camera Control</title>
<authors>JoyD</authors>
<description>Thermal camera control library</description>
<copyright>Copyright 2025</copyright>
<title>$title</title>
<authors>$authors</authors>
<owners>$owners</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>$description</description>
<releaseNotes>$releaseNotes</releaseNotes>
<copyright>$copyright</copyright>
<tags>$tagsString</tags>
<projectUrl>$projectUrl</projectUrl>
<licenseUrl>$licenseUrl</licenseUrl>
<iconUrl>$iconUrl</iconUrl>
<!-- -->
<!-- <dependencies> -->
<!-- <group targetFramework=".NETFramework4.0"> -->
<!-- <dependency id="Newtonsoft.Json" version="13.0.1" /> -->
<!-- </group> -->
<!-- </dependencies> -->
</metadata>
<files>
<file src="$targetDllName" target="lib\net40\" />
@@ -131,7 +168,7 @@ $nuspecContent = @"
</package>
"@
Set-Content -Path $nuspecPath -Value $nuspecContent
Set-Content -Path $nuspecPath -Value $nuspecContent -Encoding UTF8
Write-Host "已创建nuspec文件: $nuspecPath"
# 手动创建nupkg包结构
@@ -222,6 +259,11 @@ if (Test-Path $nupkgFilePath) {
Write-Host "✅ 成功: 包发布成功" -ForegroundColor Green
Write-Host "包ID: $packageId"
Write-Host "版本: $version"
Write-Host "标题: $title"
Write-Host "作者: $authors"
Write-Host "所有者: $owners"
Write-Host "描述: $description"
Write-Host "标签: $tagsString"
Write-Host "仓库: $server"
} else {
Write-Host "❌ 错误: 包创建成功但发布失败" -ForegroundColor Red