修改发布脚本
This commit is contained in:
@@ -33,6 +33,6 @@ using System.Runtime.InteropServices;
|
||||
//通过使用 "*",如下所示:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.1")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.1")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.4")]
|
||||
|
||||
// NuGet包相关信息已在项目文件中配置
|
||||
|
||||
@@ -42,14 +42,17 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DocumentationFile>$(AssemblyName).xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DocumentationFile>$(OutputPath)$(AssemblyName).xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
|
||||
@@ -7,7 +7,6 @@ $output = Join-Path $scriptDir "Output"
|
||||
$server = "http://47.111.181.23:8081/repository/nuget-releases/"
|
||||
$key = "admin:admin"
|
||||
$actualDllName = "JoyD.Windows.CS.Toprie.dll"
|
||||
$targetDllName = "Toprie.dll"
|
||||
|
||||
# 从AssemblyInfo.cs获取版本号
|
||||
$assemblyInfoPath = "$scriptDir\Toprie\Properties\AssemblyInfo.cs"
|
||||
@@ -62,24 +61,19 @@ if (!(Test-Path $output)) {
|
||||
# 定义pdb和xml文件名称
|
||||
$actualPdbName = $actualDllName -replace "\.dll$", ".pdb"
|
||||
$actualXmlName = $actualDllName -replace "\.dll$", ".xml"
|
||||
$targetPdbName = $targetDllName -replace "\.dll$", ".pdb"
|
||||
$targetXmlName = $targetDllName -replace "\.dll$", ".xml"
|
||||
|
||||
# 清理之前的构建文件
|
||||
Write-Host "清理之前的构建文件.."
|
||||
if (Test-Path "$output\$actualDllName") { Remove-Item -Path "$output\$actualDllName" -Force }
|
||||
if (Test-Path "$output\$actualPdbName") { Remove-Item -Path "$output\$actualPdbName" -Force }
|
||||
if (Test-Path "$output\$actualXmlName") { Remove-Item -Path "$output\$actualXmlName" -Force }
|
||||
if (Test-Path "$output\$targetDllName") { Remove-Item -Path "$output\$targetDllName" -Force }
|
||||
if (Test-Path "$output\$targetPdbName") { Remove-Item -Path "$output\$targetPdbName" -Force }
|
||||
if (Test-Path "$output\$targetXmlName") { Remove-Item -Path "$output\$targetXmlName" -Force }
|
||||
if (Test-Path "$output\$nupkgFileName") { Remove-Item -Path "$output\$nupkgFileName" -Force }
|
||||
if (Test-Path "$output\$packageId.nuspec") { Remove-Item -Path "$output\$packageId.nuspec" -Force }
|
||||
|
||||
# 构建项目(确保生成pdb和xml文件)
|
||||
Write-Host "1. 正在构建项目..."
|
||||
Write-Host "当前目录: $scriptDir"
|
||||
dotnet build "$scriptDir\Toprie\Toprie.csproj" -c Release -o "$output" /p:DebugSymbols=true /p:DebugType=full /p:DocumentationFile=true
|
||||
dotnet build "$scriptDir\Toprie\Toprie.csproj" -c Release -o "$output" /p:DebugSymbols=true /p:DebugType=full /p:DocumentationFile=JoyD.Windows.CS.Toprie.xml
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Host "错误: 构建失败!" -ForegroundColor Red
|
||||
@@ -92,20 +86,8 @@ if (!(Test-Path "$output\$actualDllName")) {
|
||||
exit 1
|
||||
}
|
||||
|
||||
# 复制DLL并重命名用于打包
|
||||
Copy-Item -Path "$output\$actualDllName" -Destination "$output\$targetDllName" -Force
|
||||
Write-Host "已将 $actualDllName 复制并重命名为$targetDllName 用于打包"
|
||||
|
||||
# 复制PDB和XML文件并重命名用于打包
|
||||
if (Test-Path "$output\$actualPdbName") {
|
||||
Copy-Item -Path "$output\$actualPdbName" -Destination "$output\$targetPdbName" -Force
|
||||
Write-Host "已将 $actualPdbName 复制并重命名为$targetPdbName 用于打包"
|
||||
}
|
||||
|
||||
if (Test-Path "$output\$actualXmlName") {
|
||||
Copy-Item -Path "$output\$actualXmlName" -Destination "$output\$targetXmlName" -Force
|
||||
Write-Host "已将 $actualXmlName 复制并重命名为$targetXmlName 用于打包"
|
||||
}
|
||||
# 直接使用原始文件名,无需复制重命名
|
||||
Write-Host "使用原始文件名: $actualDllName"
|
||||
|
||||
# 复制图标文件到输出目录
|
||||
if (Test-Path $iconSourcePath) {
|
||||
@@ -174,9 +156,9 @@ $tempProjContent = @"
|
||||
<NoBuild>true</NoBuild>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="$targetDllName" Pack="true" PackagePath="lib\net40\$targetDllName" />
|
||||
<Content Include="$targetPdbName" Pack="true" PackagePath="lib\net40\$targetPdbName" />
|
||||
<Content Include="$targetXmlName" Pack="true" PackagePath="lib\net40\$targetXmlName" />
|
||||
<Content Include="$actualDllName" Pack="true" PackagePath="lib\net40\$actualDllName" />
|
||||
<Content Include="$actualPdbName" Pack="true" PackagePath="lib\net40\$actualPdbName" />
|
||||
<Content Include="$actualXmlName" Pack="true" PackagePath="lib\net40\$actualXmlName" />
|
||||
<Content Include="$iconFileName" Pack="true" PackagePath="$iconFileName" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -220,9 +202,9 @@ $nuspecContent = @"
|
||||
<!-- </dependencies> -->
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="$targetDllName" target="lib\net40\" />
|
||||
<file src="$targetPdbName" target="lib\net40\" />
|
||||
<file src="$targetXmlName" target="lib\net40\" />
|
||||
<file src="$actualDllName" target="lib\net40\" />
|
||||
<file src="$actualPdbName" target="lib\net40\" />
|
||||
<file src="$actualXmlName" target="lib\net40\" />
|
||||
<file src="$iconFileName" target="\" />
|
||||
</files>
|
||||
</package>
|
||||
@@ -247,22 +229,22 @@ if (!(Test-Path $libDir)) {
|
||||
}
|
||||
|
||||
# 复制DLL到包结构中
|
||||
$sourceDllPath = Join-Path $output $targetDllName
|
||||
$destDllPath = Join-Path $libDir $targetDllName
|
||||
$sourceDllPath = Join-Path $output $actualDllName
|
||||
$destDllPath = Join-Path $libDir $actualDllName
|
||||
Copy-Item -Path $sourceDllPath -Destination $destDllPath -Force
|
||||
Write-Host "已复制$sourceDllPath 到$destDllPath"
|
||||
|
||||
# 复制PDB文件到包结构中
|
||||
$sourcePdbPath = Join-Path $output $targetPdbName
|
||||
$destPdbPath = Join-Path $libDir $targetPdbName
|
||||
$sourcePdbPath = Join-Path $output $actualPdbName
|
||||
$destPdbPath = Join-Path $libDir $actualPdbName
|
||||
if (Test-Path $sourcePdbPath) {
|
||||
Copy-Item -Path $sourcePdbPath -Destination $destPdbPath -Force
|
||||
Write-Host "已复制$sourcePdbPath 到$destPdbPath"
|
||||
}
|
||||
|
||||
# 复制XML文件到包结构中
|
||||
$sourceXmlPath = Join-Path $output $targetXmlName
|
||||
$destXmlPath = Join-Path $libDir $targetXmlName
|
||||
$sourceXmlPath = Join-Path $output $actualXmlName
|
||||
$destXmlPath = Join-Path $libDir $actualXmlName
|
||||
if (Test-Path $sourceXmlPath) {
|
||||
Copy-Item -Path $sourceXmlPath -Destination $destXmlPath -Force
|
||||
Write-Host "已复制$sourceXmlPath 到$destXmlPath"
|
||||
|
||||
Reference in New Issue
Block a user