我无法弄清楚如何在 Cake 中使用 XmlPoke 更改 XML 节点的内部文本值。我不断收到的错误是Error: Expression must evaluate to a node-set.
我的 XML 看起来像这样
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<publishUrl>This value must be set to your local path</publishUrl>
<DeleteExistingFiles>False</DeleteExistingFiles>
</PropertyGroup>
</Project>
我的build.cake
样子是这样的
// Update the publish path in the pubxml
XmlPoke(publishProfile, "/Project/PropertyGroup/publishUrl/", buildPaths.PublishDirectory);
// The publishProfile is just the location of the XML file
// The buildPaths.PublishDirectory is the value I'm trying to set the inner text to