Share via


Target _CopyFilesMarkedCopyLocal skipped to run

Question

Friday, August 28, 2009 6:49 AM

Hello,

I've been looking at this for some days but still not get resolved.

Recently our nightly build failed due to compiling one project - as the assembly it referenced (project reference) not get copied to local for unknow reason.

We're using the command: MSBUILD <App>.sln /t:Rebuild /p:configuration=release to build the solution. When I looked at the log it outputs I found the _CopyFilesMarkedCopyLocal didn't run which pulls the referenced assembly into local output(bin\Release)

This is odd as other project which reference the same assembly behaved correctly.
Look at the following projects structure - both project A and project B (referenced by project 1) reference project x, project A successfully copied assembly from project x when building, but project B didn't.
And it's even odd that the build is ok if I built it against project1 (both project A and project B copied reference assembly correctly), or built project B directly.

<App.sln>
    <project1>
        reference: <project A>
                        reference: project x
        reference: <project B>
                        reference: project x
    <project2>
    <...>

Can anyone give me some hints to dig out, I'm really lost...

Thanks


ArcJeremy

All replies (1)

Monday, August 31, 2009 9:32 AM ✅Answered

Hi ArcJeremy,

Please refer to this article in MSDN: Best Practices For Creating Reliable Builds . As the article says:

If you have a large build and you want to make sure that no files are copied locally, you can override the _CopyFilesMarkedCopyLocal target, which is responsible for the copy local behavior. If you override this target after the Import statement for Microsoft.CSharp.targets or Microsoft.VisualBasic.targets, you are guaranteed that no files will be copied locally. It is not generally recommended to override any element that includes a leading underscore, but this is a special case. Local reference copying can cause a lot of wasted time and drive space during large builds, so overriding the element can be justified.

Please note the bolder sentence. Is it the case?

Best Regards,
Nancy

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.