none
How to rename webpart after creating new Visual Web Part project for SP 2010?

    Question

  • Whenever I create a new Visual Web Part for SP2010 (which is amazingly simply), I have the option to name the project. Once I do this, it automatically names everything the following inside my project:

    VisualWebPart1
       VisualWebPart1.cs
       VisualWebPart1.webpart
       VisualWebPart1UserControl1.ascx
    ... and so on...

    Is there an easy way to rename all of these? Of course I can rename each file individually and then edit the code to reflect these changes, but there must be a better way. Could someone help me with this?

    • Edited by Mike Walsh FIN Friday, March 12, 2010 4:47 AM " for SP 2010" added to Title (it would have saved me needing to read the post)
    • Moved by Mike Walsh FIN Friday, March 12, 2010 4:48 AM 2010 questions do not go to forums wit "Pre-SharePoint 2010" in the name. Post them only to a suitable *2010* forum (From:SharePoint - Development and Programming (pre-SharePoint 2010))
    Thursday, March 11, 2010 10:06 PM

Answers

  • I would probably just delete the web part it creates and create a new one.  This is why I typically just use the empty SharePoint project template.
    Corey Roth blog: www.dotnetmafia.com twitter: @coreyroth
    • Marked as answer by josh6847 Monday, April 19, 2010 6:42 PM
    Friday, March 12, 2010 3:47 PM
  • Yes I believe this was a design decision to map the functionality in how another VS template type works.   The "Add New Item" features for adding SPIs covers that.  So I agree with Corey - either delete the web part and add a new one, or start with the blank template and add a web part naming it what you want. 

    Of course to the VS 2010 team we'd love a "Rename" feature that is smart enough to target all the pertinent artifacts in vNext.  ;)

    VR,
    Dave Milner
    • Marked as answer by josh6847 Monday, April 19, 2010 6:43 PM
    Friday, March 12, 2010 4:37 PM

All replies

  • I would probably just delete the web part it creates and create a new one.  This is why I typically just use the empty SharePoint project template.
    Corey Roth blog: www.dotnetmafia.com twitter: @coreyroth
    • Marked as answer by josh6847 Monday, April 19, 2010 6:42 PM
    Friday, March 12, 2010 3:47 PM
  • Yes I believe this was a design decision to map the functionality in how another VS template type works.   The "Add New Item" features for adding SPIs covers that.  So I agree with Corey - either delete the web part and add a new one, or start with the blank template and add a web part naming it what you want. 

    Of course to the VS 2010 team we'd love a "Rename" feature that is smart enough to target all the pertinent artifacts in vNext.  ;)

    VR,
    Dave Milner
    • Marked as answer by josh6847 Monday, April 19, 2010 6:43 PM
    Friday, March 12, 2010 4:37 PM