views:

2517

answers:

5

What files do I need to put the header comment in for adding GPL to a C# project?

Does form generated code require it?

Does just need to be in every *.cs file?

Is there a resource or in-depth list of language-specific steps required to add GPL to any kind of project?

+5  A: 

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.

Edit: The recommended practice is to to add the notice in every file. But not doing so will not invalidate the license or change the meaning of it.

Pop Catalin
This is not recommended practice. Please see my answer and the GPL Howto linked from there (http://www.gnu.org/licenses/gpl-howto.html)
David Schmitt
David, for technical reasons, you can't easily add notices to all files in a C# project (there are files that are generated and regenerated often), even if you add the notice to those files, someone loading the solution will regenerate them. So in this case for consistency a single file may be ok.
Pop Catalin
Do not ship generated files. If they are regenerated by the recipient, they are obviously derived works which, too, fall under the GPL.
David Schmitt
David, without the generate files the project is not functional, in C# a designer file is generated by the designer, and the designer uses "that file" to reconstruct the control. The process is 2 way.
Pop Catalin
+1  A: 

GPL is a license - there is no 'requirement' to include the actual text of the license in every single source file.

Simply provide a file called license.txt which contains the license in your project should be more than enough I would have thought.

If I am wrong, please tell me where you got this requirement from?

samjudson
I always initially thought it was a requirement after reading the details on the GPL information page thingy. Thanks for the clarifications guys.
RodgerB
+1  A: 

Monodevelop suggests adding the following to each file:

${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

Sklivvz
+1  A: 

Tip: Resharper for Visual Studio has nice feature of specifying the file header (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.

That's how I add license header to my open-source projects,

Rinat Abdullin
Although note that it some jurisdictions it is not permitted to automatically update a copyright year. May not be inherently illegal, just that you are claiming a false copyright date, since a minor change to the text, performed automatically, is unlikely to constitute creative work.
Steve Jessop
+7  A: 

The canonical answer is in the 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).

The recommended header for applying the GPL is:

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/.

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.

David Schmitt
You do have a point that the source could be distributed by itself. It just seems crazily impractical. Are there any free extensions for visual studio to make this job easier (free, I'm a student with no money ;))
RodgerB
"it has to be added to every file", no it doesn't have to, it's recommended, but not obligatory, it's a big difference.
Pop Catalin