How can I set the build version on dotnet core projects in VS2017?
Is it through a build step over powershell to include the the version
tag on .csproj file or is there a better way?
How can I set the build version on dotnet core projects in VS2017?
Is it through a build step over powershell to include the the version
tag on .csproj file or is there a better way?
I've created a PowerShell Build Step with the following script and worked fine:
$newBuildNumber = "%build.number%"
$files = Get-ChildItem -Path "*.csproj" -Recurse
foreach( $file in $files ) {
Write-Host "Processing: " $file.Name
$info = [xml] (Get-Content $file)
if($info.Project.PropertyGroup.Version){
$info.Project.PropertyGroup.Version = $newBuildNumber
}
else {
$newChild = $info.CreateElement("Version")
$newChild.set_InnerXml($newBuildNumber)
$info.Project.PropertyGroup.AppendChild($newChild)
}
$info.Save($file)
}