Commit 99f8990
authored
[build] Fix for MSBuild 16.8 (#755)
We have some "clever" code that attempts to determine if it needs to
add `Java.Interop/JniEnvironment.g.cs` to `@(Compile)`, since it may
already be there because of file globs, if this isn't a clean/initial
build.
However, this code no longer seems to work under MSBuild 16.8:
`$(_AddCompile)` remains `False` and thus the file isn't getting
added to the compile on the first build.
Instead, use `%(KeepDuplicates)='false'` to do the de-duping for us.
The wrinkle is that this file is added as
`Java.Interop/JniEnvironment.g.cs` or
`Java.Interop\JniEnvironment.g.cs`, depending on host OS, so we need
to use `Path.Combine()` to ensure our added file matches the copy
from the glob, so the de-dupe will work.
Without any de-duping, the build produces a warning:
CS2002: Source file 'JniEnvironment.g.cs' specified multiple times.1 parent 99897b2 commit 99f8990
1 file changed
+1
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | 19 | | |
23 | 20 | | |
24 | 21 | | |
25 | 22 | | |
26 | | - | |
| 23 | + | |
27 | 24 | | |
28 | 25 | | |
29 | 26 | | |
| |||
0 commit comments