提交 514133f1 编写于 作者: S Sam Harwell

Use XPath in Get-VersionCore so the implementation is more robust

上级 60101eb6
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -->
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project>
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
......
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -->
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project>
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
......
......@@ -245,12 +245,9 @@ function Get-VersionCore([string]$name, [string]$versionFile) {
$name = $name.Replace("-", "")
$nodeName = "$($name)Version"
$x = [xml](Get-Content -raw $versionFile)
$node = $x.Project.PropertyGroup.FirstChild
while ($node -ne $null) {
if ($node.Name -eq $nodeName) {
return $node.InnerText
}
$node = $node.NextSibling
$node = $x.SelectSingleNode("//Project/PropertyGroup/$nodeName")
if ($node -ne $null) {
return $node.InnerText
}
throw "Cannot find package $name in $versionFile"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册