将GPL许可证添加到C#项目
时间:2020-03-06 14:55:24 来源:igfitidea点击:
为了将GPL添加到Cproject,我需要添加哪些文件的标题注释?
表单生成的代码是否需要它?
是否只需要存在于每个* .cs文件中?
将GPL添加到任何类型的项目中是否需要资源或者特定于语言的步骤的详细列表?
解决方案
我们确实不需要向每个文件添加GPL通知。我们可以在根文件夹中的许可证文件中指定整个项目的许可证。
编辑:建议的做法是在每个文件中添加通知。但是,不这样做将不会使许可证无效或者更改其含义。
GPL是许可证,没有"要求"在每个单个源文件中包含许可证的实际文本。
只需提供一个名为license.txt的文件,其中包含我们项目中的许可证就应该足够了。
如果我错了,请告诉我我们从何处获得此要求?
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
提示:Visual Studio的Resharper具有指定文件头(Options-Languages-Common-File Header Text)的出色功能。
如果指定它,然后在整个解决方案上执行"代码清除",则每个* .cs文件都将获得更新的标头。
这就是我向开放源代码项目添加许可证标头的方式,
规范的答案在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).
建议使用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/.
是的,应该将其添加到每个文件中,因为我们不能合法地依赖每个接收者都收到作品的假设。而且,不,它不一定是完整的许可证文本。