Tech/XmlStar.md
... ...
@@ -34,4 +34,35 @@ Output:
34 34
foo bar
35 35
feed back
36 36
37
+# Visual Studio Projects
38
+Must specify the namespace. Tidier to predifine it.
39
+
40
+```
41
+# -N: predefine namespace
42
+xmlstarlet sel -N _=http://schemas.microsoft.com/developer/msbuild/2003 "//_:AdditionalLibraryDirectories" $PROJECT_FILE
43
+```
44
+
45
+## Delete Project References
46
+
47
+```
48
+# -L: inplace
49
+# -d: delete nodes where the @Include contains $dep
50
+dep=$1
51
+xmlstarlet ed -L -N _=http://schemas.microsoft.com/developer/msbuild/2003 -d "//_:ProjectReference[contains(@Include,\"${dep}\")]" $PROJECT_FILE
52
+```
53
+
54
+## Fix projects that don't inherit from parent
55
+
56
+```
57
+# -u: update the element
58
+# -x: update with expression
59
+xmlstarlet ed -P -L -N _=http://schemas.microsoft.com/developer/msbuild/2003 \
60
+ -u "//_:AdditionalIncludeDirectories[not(contains(.,\"%(AdditionalIncludeDirectories)\"))]" \
61
+ -x "concat(.,\"%(AdditionalIncludeDirectories)\",';')" \
62
+ -u "//_:AdditionalLibraryDirectories[not(contains(.,\"%(AdditionalLibraryDirectories)\"))]" \
63
+ -x "concat(.,\"%(AdditionalLibraryDirectories)\",';')" \
64
+ $*
65
+```
66
+
67
+
37 68
[1]: https://sourceforge.net/p/xmlstar/code/ci/master/tree/
... ...
\ No newline at end of file