1

我正在尝试将 Squirrel 配置为与 Jenkins 一起使用。我有一个仅显示内部版本号的简单项目(仅为测试而创建)。

我已经将詹金斯设置为

在此处输入图像描述

我如何知道它必须采用 assembly.cs 中的版本?以及如何将该信息传递给 squirrel 命令?

谢谢

4

1 回答 1

0

我没有使用 Jenkins 的经验,但这是我在构建后脚本中所做的。版本通过@(VersionNumber)参数传递给修改.nuspec文件的 powershell 脚本。我假设您可能必须在调用该Execute Windows Batch Command函数来发布您的应用程序之前执行类似的操作。

Visual Studio 生成后事件命令行

if $(ConfigurationName) ==Release "C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -ExecutionPolicy RemoteSigned -file "$(ProjectDir)\"PostBuild.ps1 "$(ProjectDir) " @(VersionNumber)

PostBuild.ps1

param (
[string]$ProjectDir,
[string]$Revision
)

    #write new version to nuspec
    $nuspec_file_name = "Package.nuspec"

    $nuspec_file_path = "$ProjectDir$nuspec_file_name"
    Write-Host "nuspec file: $nuspec_file_path"
    [xml]$nuspec_xml = Get-Content($nuspec_file_path)
    $nuspec_xml.package.metadata.version = $Revision
    $nuspec_xml.Save($nuspec_file_path)
于 2016-11-29T18:52:29.187 回答