复制到输出目录属性及其用途 [英] Copy to Output Directory property and its uses

查看:90
本文介绍了复制到输出目录属性及其用途的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!

我想进一步了解复制到输出目录的工作原理吗?

用户可以在源代码中实现该属性吗?

如果是这样,它是否还适用于所有文件类型,而不仅适用于组件和数据库?


预先感谢您的回复.


JohnPDB

Hi!

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.


JohnPDB

推荐答案

从一开始:如果您的意思是项目的节点属性;是的,它适用于所有文件.
用户可以在源代码中实现该属性吗?" —当然,如果我能正确理解的话,在编写公式时就毫无意义.我会尽力解释您可以做什么.

最后,我将尝试解释其工作原理.如果我回答的是一个错误的问题,请不要怪我:您没有正确解释,您指的是哪种财产,所以我假设您指的是所示的财产,尤其是针对Visual Studio项目节点.实际上,这是可以使用应用程序MSBuild.exe构建的基于XML的标准项目文件的属性.顺便说一句,此应用程序以及C#和VB.NET编译器随可自由重新分发的.NET Framework一起免费提供,因此您不需要Visual Studio或任何其他商业许可的软件工具即可构建项目.您甚至可以在没有Visual Studio的情况下进行所有.NET开发.该项目格式也适用于Mono( http://en.wikipedia.org/wiki/Mono_%28software%29 [ ^ ], http://www.mono-project.com/ [ http://msdn.microsoft.com/en-us/library/ms171468 [ ^ ].

该项目文档具有许多功能;财产的概念只是其中之一.您可以编写自定义属性,尤其是-创建自定义任务(请参阅 http://msdn.microsoft.com/en-us/library/microsoft.build.utilities.task.aspx [配置,这只是另一个属性).反过来,此操作是构建系统中可用的基本任务之一.如果要开发自定义项目,可以使用此任务.

基于MSBuild的构建技术是一个非常灵活且强大的系统.它跟踪文件和时间戳之间的依赖性,从而允许增量构建而无需重复步骤,并且与经典"构建相比,它在自定义方面非常强大.实际上,您可以以专门接口的.NET程序集的形式创建自定义任务和其他与构建相关的组件,并将其轻松插入系统中.您甚至可以使用此系统使用与Visual Studio和Microsoft没有任何共同之处的语言和其他工具来设计构建项目,并且可以在非Microsoft系统上(例如,通过Mono)进行构建.

您可以从这一点开始学习所有内容:
http://msdn.microsoft.com/en-us/library/wea2sca5% 28v = vs.90%29 [ ^ ].

对于构建API,您可以从此处开始:
http://msdn.microsoft.com/en-us/library/gg145008 [ ^ ].

—SA
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 (http://en.wikipedia.org/wiki/Mono_%28software%29[^], http://www.mono-project.com/[^]), 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:
http://msdn.microsoft.com/en-us/library/ms171468[^].

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 http://msdn.microsoft.com/en-us/library/t9883dzc.aspx[^], http://msdn.microsoft.com/en-us/library/microsoft.build.utilities.task.aspx[^]).

"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:
http://msdn.microsoft.com/en-us/library/wea2sca5%28v=vs.90%29[^].

For build API, you can start here:
http://msdn.microsoft.com/en-us/library/gg145008[^].

—SA


这篇关于复制到输出目录属性及其用途的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆