@@ -48,7 +48,7 @@ module Types =
4848 | Exe
4949 | Custom of string
5050
51- type ProjectItem = Compile of name : string * fullpath : string
51+ type ProjectItem = Compile of name : string * fullpath : string * metadata : Map<string , string > option
5252
5353 type ProjectOptions = {
5454 ProjectId: string option
@@ -75,10 +75,37 @@ module Types =
7575 member x.ResolvedTargetPath =
7676 defaultArg x.TargetRefPath x.TargetPath
7777
78+ /// Represents a ` <Compile> ` node within an fsproj file.
7879 type CompileItem = {
80+ /// The ` Compile ` node's Include contents, after MSBuild has finished evaluation.
81+ /// For example:
82+ /// * ` <Compile Include="Foo.fs"/> ` would have this set to "Foo.fs";
83+ /// * ` <Compile Include="Bar/Baz.fs"/> ` would have ` "Bar/Baz.fs" ` ;
84+ /// * (contrived): ` <Compile Include="$(IsPackable).fs"/> ` might have ` true.fs ` or ` false.fs ` , for example.
7985 Name: string
86+ /// Full path on disk to the F# file this ` Compile ` node is telling MsBuild to compile.
8087 FullPath: string
88+ /// Value of the ` <Link /> ` sub-node, if one exists.
89+ /// For example, ` <Compile Include="Foo.fs"><Link>../bar.fs</Link></Compile ` would set this to
90+ /// "../bar.fs" (no further path resolution takes place).
8191 Link: string option
92+ /// All the other metadata in the project file associated with this Compile node.
93+ /// This is a map of "name of metadata key" to "contents of that key".
94+ /// Recall that according to MsBuild, those contents are not actually unrestricted XML, although they sure do look like it!
95+ /// If you try and put XML as a metadata value, MsBuild will just give it to you as a string, or will fail to load the
96+ /// project at all.
97+ ///
98+ /// For example:
99+ /// * ` <Compile Include="Foo.fs"><Something>hello</Something></Compile> ` sets the metadata key "Something" to the value "hello".
100+ /// * ` <Compile Include="Foo.fs"><Blah Baz="hi" /></Compile> ` fails at project load time.
101+ /// * ` <Compile Include="Foo.fs"><Blah></Blah></Compile> ` sets the metadata key "Blah" to the empty string.
102+ /// * ` <Compile Include="Foo.fs"><Blah><Quux></Quux></Blah></Compile> ` sets the metadata key "Blah" to the string "<Quux ></Quux >".
103+ ///
104+ /// This map includes the ` Link ` value, if it exists, which was also extracted for convenience into the ` Link ` field
105+ /// of this CompileItem.
106+ ///
107+ /// If you specify the same metadata key multiple times, the last value wins. (This is MsBuild's decision, not ours.)
108+ Metadata: Map < string , string >
82109 }
83110
84111 type ToolsPath = ToolsPath of string
0 commit comments