Click here to Skip to main content
13,193,048 members (80,166 online)
Rate this:
Please Sign up or sign in to vote.
See more:

I would like to know more about how the Copy to Output Directory works?

Can users implement the property in source code?

If so, will it also work on all file types and not just for components and databases?

Thanks in advance for your response.

Posted 25-May-12 15:22pm
SAKryukov 25-May-12 21:58pm
What do you mean by "implement the property in source code"? it is already implemented, you can use it...

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

From the very end: if your mean the project's node property; yes, it works on all files.
"Can user implement the property in source code" — simply makes no sense as you formulate it, if I could understand you correctly, of course. I'll try to explain what you can do.

And, finally, I'll try to explain how it works. Please don't blame me if I'm answering a wrong question: you did not explain properly, what kind of property do you mean, so I'll assume that you refer to the property shown, in particular, for the Visual Studio project node. Actually, this is a property of the XML-based standard project file which can be built using the application MSBuild.exe. By the way, this application and C# and VB.NET compilers come for free with the freely re-distributable .NET Framework, so you do not need Visual Studio or any other commercially licensed software tool to build projects; you can even do all the .NET development without Visual Studio. This project format is also valid for Mono ([^],[^]), so it can be used on many non-Microsoft platforms. Visual Studio itself does not build or compile anything; it runs the build utility, most likely through its managed interface available in .NET; you can also do it. You can read about integration of MSBuild with Visual Studio here:[^].

The project document has many features; the concept of the property is just one of them. You can write a custom property, among other things, notably — creating custom tasks (please see[^],[^]).

"Copy to Output Directory" is one of the basic properties which causes the file referenced by the project node to be copies to the output directory (which is merely another property, per configuration) as is. This action is, in turn, one of the basic tasks available in the build system. You can use this task if you want to develop a custom project.

The build technology based on MSBuild is a very flexible and robust system; it tracks dependencies between files and time stamps which allows for incremental build free from repeated steps and it is very power in terms of customization, compared to "classic" build. Practically, you can create custom tasks and other build-related component in the form of specially interfaced .NET assemblies and easily plug them in the system. You can even use this system to design a build project using the languages and other tools having nothing in common with Visual Studio and Microsoft, and you can do it on non-Microsoft systems (via Mono, for example).

You can learn it all starting from this point:[^].

For build API, you can start here:[^].


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.171017.2 | Last Updated 25 May 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100