Found by code inspection while implementing #1857:
-
We only add preprocessed content with CopyToOutput=true to ReferenceCopyLocalPaths when CopyLocalLockFileAssemblies is true, but they should be copied irrespective of that setting.
-
We set TargetPath based on the OutputPath of the item, but ReferenceCopyLocalPaths only respect DestinationSubDirectory: https://github.com/Microsoft/msbuild/blob/c81a2935b54d7a5fac075d472e09e72ac198b893/src/Tasks/Microsoft.Common.CurrentVersion.targets#L4297
-
Every other incremental build will recompile if there is a preprocessed compile item.
- This is because we only add to FileWrites if we produced the file and then IncrementalClean comes along and deletes it.
I suspect (1) and (2) haven't been noticed because a contentFile item that is both preprocessed and copied to output is rare. I started to fix these inline with #1857, but found it hard to find package assets to stress these cases so I'm punting it to this bug since this behavior has always been like this.
Found by code inspection while implementing #1857:
We only add preprocessed content with CopyToOutput=true to ReferenceCopyLocalPaths when CopyLocalLockFileAssemblies is true, but they should be copied irrespective of that setting.
We set TargetPath based on the OutputPath of the item, but ReferenceCopyLocalPaths only respect DestinationSubDirectory: https://github.com/Microsoft/msbuild/blob/c81a2935b54d7a5fac075d472e09e72ac198b893/src/Tasks/Microsoft.Common.CurrentVersion.targets#L4297
Every other incremental build will recompile if there is a preprocessed compile item.
I suspect (1) and (2) haven't been noticed because a contentFile item that is both preprocessed and copied to output is rare. I started to fix these inline with #1857, but found it hard to find package assets to stress these cases so I'm punting it to this bug since this behavior has always been like this.