打包中包含pdb和xml
This commit is contained in:
@@ -60,6 +60,11 @@ if (!(Test-Path $output)) {
|
||||
Write-Host "清理之前的构建文件.."
|
||||
if (Test-Path "$output\$actualDllName") { Remove-Item -Path "$output\$actualDllName" -Force }
|
||||
if (Test-Path "$output\$targetDllName") { Remove-Item -Path "$output\$targetDllName" -Force }
|
||||
# 添加清理pdb和xml文件
|
||||
$actualPdbName = [System.IO.Path]::ChangeExtension($actualDllName, ".pdb")
|
||||
$actualXmlName = [System.IO.Path]::ChangeExtension($actualDllName, ".xml")
|
||||
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\$nupkgFileName") { Remove-Item -Path "$output\$nupkgFileName" -Force }
|
||||
if (Test-Path "$output\$packageId.nuspec") { Remove-Item -Path "$output\$packageId.nuspec" -Force }
|
||||
|
||||
@@ -79,6 +84,18 @@ if (!(Test-Path "$output\$actualDllName")) {
|
||||
exit 1
|
||||
}
|
||||
|
||||
# 验证pdb和xml文件是否存在
|
||||
$actualPdbName = [System.IO.Path]::ChangeExtension($actualDllName, ".pdb")
|
||||
$actualXmlName = [System.IO.Path]::ChangeExtension($actualDllName, ".xml")
|
||||
|
||||
if (!(Test-Path "$output\$actualPdbName")) {
|
||||
Write-Host "警告: 在输出目录中找不到$actualPdbName! 将继续打包但缺少调试信息" -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
if (!(Test-Path "$output\$actualXmlName")) {
|
||||
Write-Host "警告: 在输出目录中找不到$actualXmlName! 将继续打包但缺少文档注释" -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
# 直接使用实际DLL文件,不进行重命名
|
||||
Write-Host "使用实际DLL文件: $actualDllName 用于打包"
|
||||
|
||||
@@ -194,6 +211,8 @@ $nuspecContent = @"
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="$targetDllName" target="lib\net40\" />
|
||||
<file src="$([System.IO.Path]::ChangeExtension($targetDllName, ".pdb"))" target="lib\net40\" />
|
||||
<file src="$([System.IO.Path]::ChangeExtension($targetDllName, ".xml"))" target="lib\net40\" />
|
||||
<file src="$iconFileName" target="\" />
|
||||
</files>
|
||||
</package>
|
||||
@@ -223,6 +242,24 @@ $destDllPath = Join-Path $libDir $targetDllName
|
||||
Copy-Item -Path $sourceDllPath -Destination $destDllPath -Force
|
||||
Write-Host "已复制$sourceDllPath 到$destDllPath"
|
||||
|
||||
# 复制pdb文件到包结构中
|
||||
$targetPdbName = [System.IO.Path]::ChangeExtension($targetDllName, ".pdb")
|
||||
$sourcePdbPath = Join-Path $output $targetPdbName
|
||||
$destPdbPath = Join-Path $libDir $targetPdbName
|
||||
if (Test-Path $sourcePdbPath) {
|
||||
Copy-Item -Path $sourcePdbPath -Destination $destPdbPath -Force
|
||||
Write-Host "已复制$sourcePdbPath 到$destPdbPath"
|
||||
}
|
||||
|
||||
# 复制xml文件到包结构中
|
||||
$targetXmlName = [System.IO.Path]::ChangeExtension($targetDllName, ".xml")
|
||||
$sourceXmlPath = Join-Path $output $targetXmlName
|
||||
$destXmlPath = Join-Path $libDir $targetXmlName
|
||||
if (Test-Path $sourceXmlPath) {
|
||||
Copy-Item -Path $sourceXmlPath -Destination $destXmlPath -Force
|
||||
Write-Host "已复制$sourceXmlPath 到$destXmlPath"
|
||||
}
|
||||
|
||||
# 复制图标文件到包结构根目录
|
||||
$sourceIconPath = Join-Path $output $iconFileName
|
||||
$destIconPath = Join-Path $tempDir $iconFileName
|
||||
|
||||
Reference in New Issue
Block a user