Skip to content

CopyIfNewer file created by prebuild step is not copied until subsequent build #3216

@emz00

Description

@emz00

I have a config file in my project (instance.config) that I want copied to the output directory, so it's set to "Copy if newer". This config file is not checked into source control, but there is a file (instance.config.template), which gets copied to instance.config if that doesn't already exist. This all works, but not in the same build: the first build copies instance.config to the source directory and only the next build copies it to the output. As it's the pre-build step, I would expect any files it generates to be treated like any other source files, so in this case, instance.config should be copied to the output by the first build after a clean checkout.

CopySourceFileInPreBuild.zip reproduces the problem.

I even tried getting the pre-build step to modify another source file, but that doesn't help.

A workaround is to create a post-build step to copy the file to the output instead of relying on the build system to do it, but a downside to this is that the project then gets built every time. For a large project this can be a major problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-ExternalOwned by another feature area and not this repo. Likely be closed in lieu of issue against it.Discussion/QuestionA discussion or question about the project that will not be treated as a bug or feature request.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions