none
How do I have a comment inserted at the top of every new code file I create?

    Question

  • I used to use WebStorm and am now trying out visual studio as my new IDE to see if I want to switch. In webstorm I had my project setup so that everytime a new javascript file was created it automatically had my boilerplate legal comment at the top.

    E.g.

    /**********************

    * Legalese goes here

    **********************/

    How do I do this in Visual Studio 2015 Community Edition? I couldn't even find how to get to the project settings so some direction on how to get there would be very helpful as well.

    Thanks,

    Alex


    Thanks, Alex

    Wednesday, September 14, 2016 2:18 PM

All replies


  • You can add a comment with the License Header Manager extension.

    Sergey Vlasov | Vlasov Studio | Visual Studio add-ins, extensions and tools

    Thursday, September 15, 2016 3:16 AM
  • Hi Alex,

    You could create your custom item template for Javascript. Please create the Item Template with following steps.

    1. Create a sample project and add a Javascript file in your project.
    2. Edit this Javascript to add your boilerplate legal comment at the top.
    3. Save all files in your project.
    4. Open the File menu to choose "Export Template" option.
    5. Select "Item Template" and then do the operations following the Export Template Wizard.
    6. After export successful, please restart your Visual Studio.
    7. In your project, please choose Add -> New Items, you will find the exported item template that include your boilerplate legal comment.

    More detailed information, please refer to:

    https://msdn.microsoft.com/en-us/library/tsyyf0yh.aspx?f=255&MSPPError=-2147217396

    Best Regards,
    Weiwei

     


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, September 15, 2016 6:44 AM
    Moderator
  • Thanks, I tried that but can't get it to work. Opened an issue for it in github so hopefully will get it resolved.

    Thanks, Alex

    Thursday, September 15, 2016 2:09 PM
  • Thanks but that does not work. After clicking Export Template the only language categories available are Visual C# and Visual Basic, and even if I choose one of those and click Next it just closes the dialog and doesn't do anything. I don't think this feature works in the current version of Visual Studio 2015 Community Edition.

    Thanks, Alex

    Thursday, September 15, 2016 2:10 PM
  • Hi Alex,

    I have tested in my Visual Studio Community 2015, it also could export Javascript file, not only for C# and VB file.

    After choose "Item Template" and click the Next button in Step 5, what do you see in next page? I get the following window which let me choose which file I want to export. It include Javascript file.

    If you don't see other project files in this window, please check whether you have installed the latest update for your Visual Studio 2015.

    Please tell use in which steps you don't get the expect result and provide some screenshot about that issue, which can help us check whether there has any issue.

    Best Regards,
    Weiwei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, September 16, 2016 6:18 AM
    Moderator
  • The problem is there is no Next page. I posted the steps I took in my previous comment:
    "After clicking Export Template the only language categories available are Visual C# and Visual Basic, and even if I choose one of those and click Next it just closes the dialog and doesn't do anything."

    Thanks, Alex

    Friday, September 16, 2016 1:34 PM
  • Hi Alex,

    Could you share a screenshot here to help us understand your issue?

    Please check your Visual Studio Community 2015 has installed the latest Update. If installed, please run your Visual Studio in safe mode, which can help us confirm whether this issue caused by third part VS packages or not.

    Then please check the ActiveLog.xml under the path of %AppData%\Microsoft\VisualStudio\14.0. This file will log all operations when you operate Visual Studio.

    Best Regards,
    Weiwei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, September 20, 2016 9:29 AM
    Moderator
  • Hi Alex,

    What's the process of exporting item template in your Visual Studio?

    Please tell us the troubleshoot result for this issue, which can help us find out the reasons.

    If you have resolved the issue, please share your solution here, which is benefit to other communities who has the same issue. Thanks.

    Best Regards,
    Weiwei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, September 23, 2016 5:22 AM
    Moderator