je le fichier XML simple:SelectNodes() appel XMLDocument ne rien renvoyer
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit http://go.microsoft.com/fwlink/?LinkID=208121.
-->
<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>False</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<publishUrl>E:\PublishTest</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
</PropertyGroup>
</Project>
Et je essaie de changer la valeur d'un des éléments en procédant comme suit:
XmlDocument xDoc = new XmlDocument();
xDoc.Load(fullPathToPortalPublishSettings);
// Change the publish url to be the one we want
var a = xDoc.SelectNodes("/Project/PropertyGroup");
Mais ça bombarde toujours. J'ai supprimé les commentaires en haut du fichier XML, j'ai essayé juste /Project
, juste Project
, et je n'arrive pas à comprendre ce qui ne va pas. J'ai regardé d'autres articles, mais je ne vois pas ce qui ne va pas chez moi. Une idée? Merci!
Je perds la barre oblique de fin pour faire '/ Project/PropertyGroup' ou sélectionne les enfants:'/Project/PropertyGroup/* ' – Kris
Désolé, j'aurais dû mentionner que j'ai essayé" xDoc.SelectNodes ("/ Project") comme – skaz
Avez-vous inspecté xDoc dans une montre? Contient-elle ce que vous attendez? – Kris