Archives

Archives / 2009 / May
  • Tips & Tricks: StyleCop copyright issue.

    Today I've started using StyleCop in my open source project. With the help of style cop you can configure copyright text, which should be added to each file. Also ReSharper plugin for StyleCop will automatically add this header after clean up. But there is a little problem with setting up copyright text if it is not a single line. With style cop setting manager u can use only single line textbox to manage copyright text. So, I strongly recommend u to use text xml editor for this purpose. Also resharper plugin will not generate copyright text correctly if it holds new lines. To avoid this issue u can add slashes by hand before all newlines. Here is an example:

       1: <StringProperty Name="Copyright">This file is part of YOUR PROJECT 
       2: // 
       3: //   YOUR PROJECT  is free software: you can redistribute it and/or modify 
       4: //   it under the terms of the GNU General Public License as published by  
       5: //   the Free Software Foundation, either version 3 of the License, or  
       6: //   (at your option) any later version.  
       7: //    
       8: //   YOUR PROJECT is distributed in the hope that it will be useful,  
       9: //   but WITHOUT ANY WARRANTY; without even the implied warranty of  
      10: //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
      11: //   GNU General Public License for more details.  
      12: //    
      13: //   You should have received a copy of the GNU General Public License  
      14: //   along with Foobar.  If not, see http://www.gnu.org/license. 
      15: </StringProperty>  
    Hope it helps!