How do I get Resharper to add a open source license at the top of each file?
views:
141answers:
4
+4
A:
If I understand you correctly, you want a comment at the top of each source file, detailing your licensing model?
If so, try Visual Studio templates.
Traveling Tech Guy
2009-11-04 06:26:12
+2
A:
You could make a small script with Visual Assist X though. It wouldn't do it automatically, but all you'd have to do is type lic
at the top of the page to output the licensing information.
knight666
2009-11-04 06:27:10
Assuming the licence is boilerplate text (or has only simple placeholders), you could also do this with a Visual Studio snippet.
itowlson
2009-11-04 06:33:54
+3
A:
I found the answer to this question here as I would like to do this with Resharper
Jake Scott
2009-11-04 06:37:43
I think JetBrains should actually write new VS instead of using the one from Microsoft. Everything they do is perfect.
tulskiy
2009-11-04 06:41:24
+1
A:
This is the snippet I put together for the MIT license. You open up a C# code file, you type 'license' hit tab twice and you are defaulted to the year and copyright holder sections.
Here is a link that describes the process. Hope this helps.
<?xml version="1.0" encoding="utf-8" ?> <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> <CodeSnippet Format="1.0.0"> <Header> <Title>Simple MIT License</Title> <Shortcut>license</Shortcut> <Description> The standard MIT licnese. </Description> <Author>Example License</Author> <SnippetTypes> <SnippetType>Expansion</SnippetType> </SnippetTypes> </Header> <Snippet> <Declarations> <Literal> <ID>year</ID> <ToolTip>Copyright year</ToolTip> <Default>year</Default> </Literal> <Literal> <ID>copyrightholders</ID> <ToolTip>Replace This With the Copyright Holders name</ToolTip> <Default>copyrightholders</Default> </Literal> </Declarations> <Code Language="CSharp"> <![CDATA[ /* The MIT License Copyright (c) $year$ $copyrightholders$ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ]]> </Code> </Snippet> </CodeSnippet> </CodeSnippets>
Chris
2009-11-04 15:56:54