将 GPL 许可证添加到 C# 项目
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/153148/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Adding the GPL license to C# Projects
提问by RodgerB
What files do I need to put the header comment in for adding GPL to a C# project?
为了将 GPL 添加到 C# 项目,我需要将标题注释放入哪些文件?
Does form generated code require it?
表单生成的代码需要它吗?
Does just need to be in every *.cs file?
是否只需要在每个 *.cs 文件中?
Is there a resource or in-depth list of language-specific steps required to add GPL to any kind of project?
是否有将 GPL 添加到任何类型的项目所需的特定语言步骤的资源或深入列表?
采纳答案by David Schmitt
The canonical answer is in the GPL Howto:
规范的答案在GPL Howto 中:
Whichever license you plan to use, the process involves adding two elements to each source file of your program: a copyright notice (such as “Copyright 1999 Terry Jones”), and a statement of copying permission, saying that the program is distributed under the terms of the GNU General Public License (or the Lesser GPL).
无论您打算使用哪种许可证,该过程都涉及向程序的每个源文件添加两个元素:版权声明(例如“Copyright 1999 Terry Jones”)和复制许可声明,说明程序是根据GNU 通用公共许可证(或较小 GPL)的条款。
The recommended header for applying the GPL is:
应用 GPL 的推荐标头是:
Copyright 200X My Name
This file is part of Foobar.
Foobar is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Foobar is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Foobar. If not, see http://www.gnu.org/licenses/.
版权所有 200X 我的名字
该文件是 Foobar 的一部分。
Foobar 是免费软件:您可以根据自由软件基金会发布的 GNU 通用公共许可证(许可证的第 3 版或(由您选择)任何更高版本)的条款重新分发和/或修改它。
Foobar 是分发的,希望它有用,但没有任何保证;甚至没有对适销性或针对特定目的的适用性的暗示保证。有关更多详细信息,请参阅 GNU 通用公共许可证。
您应该已经收到一份 GNU 通用公共许可证和 Foobar。如果没有,请参阅http://www.gnu.org/licenses/。
Yes, it SHOULD be added to every file, since you cannot legally depend upon the assumption that every recipient receives your work as a whole. And, no, it doesn't have to be the complete license text.
是的,它应该被添加到每个文件中,因为您不能合法地假设每个收件人都收到您的整个作品。而且,不,它不必是完整的许可证文本。
回答by Pop Catalin
You don't realy need to add a GPL notice to every file. You can specify the license of the entire project in a license file in the root folder and that's it.
您实际上并不需要为每个文件添加 GPL 通知。您可以在根文件夹中的许可文件中指定整个项目的许可,仅此而已。
Edit: The recommended practice isto to add the notice in every file. But not doing so will not invalidate the license or change the meaning of it.
编辑:推荐的做法是在每个文件中添加通知。但不这样做不会使许可证无效或改变其含义。
回答by samjudson
GPL is a license - there is no 'requirement' to include the actual text of the license in every single source file.
GPL 是一种许可证——没有“要求”在每个源文件中包含许可证的实际文本。
Simply provide a file called license.txt which contains the license in your project should be more than enough I would have thought.
只需提供一个名为 license.txt 的文件,其中包含您项目中的许可证就足够了,我原以为就足够了。
If I am wrong, please tell me where you got this requirement from?
如果我错了,请告诉我你从哪里得到这个要求?
回答by Sklivvz
Monodevelop suggests adding the following to each file:
Monodevelop 建议将以下内容添加到每个文件中:
${FileName}
Copyright (C) ${Year} [name of author]
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
${文件名}
版权所有 (C) ${Year} [作者姓名]
该程序是免费软件;您可以根据自由软件基金会发布的 GNU 通用公共许可证的条款重新分发和/或修改它;许可证的第 2 版,或(由您选择)任何更高版本。
分发此程序是希望它有用,但不作任何保证;甚至没有对适销性或针对特定目的的适用性的暗示保证。有关更多详细信息,请参阅 GNU 通用公共许可证。您应该已经收到一份 GNU 通用公共许可证以及该程序;如果没有,请写信给 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
回答by Rinat Abdullin
Tip:Resharper for Visual Studio has nice feature of specifying the file header (Options-Languages-Common-File Header Text).
提示:Resharper for Visual Studio 具有很好的指定文件头的功能(Options-Languages-Common-File Header Text)。
If you specify it, and then perform "Code Cleanup" on the entire solution, every *.cs file will get updated header.
如果您指定它,然后对整个解决方案执行“代码清理”,则每个 *.cs 文件都将获得更新的标头。
That's how I add license header to my open-source projects,
这就是我向我的开源项目添加许可证头的方式,
回答by Sami Kerola
Please notice that the FSF postal address is not 59 Temple Place, but the one below.
请注意,FSF 的邮政地址不是 59 Temple Place,而是下面的地址。
Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
The only way not to screw up the license text is to take it from GNU web site. Notice that the site has licenses in plain text format, which is usually preferred format in comparison to html.
不搞砸许可证文本的唯一方法是从 GNU 网站上获取它。请注意,该站点具有纯文本格式的许可证,与 html 相比,这通常是首选格式。