Skip to content

Issues with preprocessed nuget contentFile handling #1898

Description

@nguerrera

Found by code inspection while implementing #1857:

  1. We only add preprocessed content with CopyToOutput=true to ReferenceCopyLocalPaths when CopyLocalLockFileAssemblies is true, but they should be copied irrespective of that setting.

  2. 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

  3. 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions