У меня есть файл, который имеет переменнуюполучить значение переменной из файла и добавления новой
$versionNumber = "1.0.0
мне нужно изменить значение переменной для "$versionNumber = "user_choice"
"явно.
#------------------------------------------------
# Pack parameters used to create the .nupkg file.
#------------------------------------------------
# Specify the Version Number to use for the NuGet package. If not specified, the version number of the assembly being packed will be used.
# NuGet version number guidance: https://docs.nuget.org/docs/reference/versioning and the Semantic Versioning spec: http://semver.org/
# e.g. "" (use assembly's version), "1.2.3" (stable version), "1.2.3-alpha" (prerelease version).
$versionNumber = "1.0.0"
# Specify any Release Notes for this package.
# These will only be included in the package if you have a .nuspec file for the project in the same directory as the project file.
$releaseNotes = ""
# Specify a specific Configuration and/or Platform to only create a NuGet package when building the project with this Configuration and/or Platform.
# e.g. $configuration = "Release"
# $platform = "AnyCPU"
$configuration = ""
$platform = ""
Любой возможный подход рекомендуется
Я использую этот скрипт в Jenkins и вызова user_choice в качестве параметра. это работает, но новое значение, что я вижу, это $ VersionNumber = 1.0.0 но фактическое значение должно заменить be $ versionNumber = "1.0.0". Здесь не хватает места и "". (Get-Content "C: \ TestFolder \ Config.ps1" -raw) -replace '(? <= \ $ VersionNumber \ s =). +', "$ Env: VERSION" | Set-Content "C: \ TestFolder \ Config.ps1" – Kally