Creating New Module Using Products as a template (copy/paste

Posted by Community Admin on 04-Aug-2018 09:23

Creating New Module Using Products as a template (copy/paste)

All Replies

Posted by Community Admin on 05-Jul-2011 00:00

Hi all,

I was trying to get a products like module up and running (like about 4 months....!) and I tried to do it by copy/pasting products module. At first, I had encountered some problem but now I believe it is good to go...

Let's assume that the module you are trying to create is called "Announcements".
Here are the steps to create a products like module using products module as a template:

1- Copy/Paste Products Module directory
2- Name the directory "AnnouncementsModuleProject"
3- Renaming files and folder:
  3.a- find all files and directories whose name contains "ProductsCatalogSample" and rename that phrase with "AnnouncementsModuleProject" (case sensitive)
  3.a- find all files and directories whose name contains "Product" and rename that phrase with "Announcement" (case sensitive)
4- Changing file contents: (using visual studio's find/replace may not work quite well since it will NOT search in the out of project files; you may want to find or write an application which performs find and replace in all files within a directory)
  4.a- find and replace all instances of "product" with "announcement" (IMPORTANT: very case sensitive)
  4.b- find and replace all instances of "Product" with "Announcement" (IMPORTANT: very case sensitive)
5- in the AssemblyInfo.cs file in "properties" folder of the project there was a line:
           [assembly: AssemblyProduct("ProductsCatalogSample")]
In the find and replace in would probably became
           [assembly: AssemblyAnnouncement("AnnouncementsModuleProject")]
correct this line by writing "AssemblyProduct" over the phrase "AssemblyAnnouncement" in this line.

6- GUID corrections on project file (at this point all changes above should have been completed)
   6.a- open project in visual studio
   6.b- unload the project
   6.c- click "edit AnnouncementsModuleProject.csproj" on projects context menu
   6.d- go to line 9 (or to the line which contains <ProjectGUID> tag: change the GUID value to a random GUID (*). Don't forget to save the file..
     originally it says "<ProjectGuid>7A9D555E-5D63-48B5-86D8-BB8EA6A0DB4A</ProjectGuid>" on line 9
 
   6-e. reload the project.

7- GUID corrections on code files: create new random GUID values (*) to
   7.a-  /properties/assemblyInfo.cs at line 24
              originally is says: [assembly: Guid("d4992245-5ae8-4e1a-9de1-194ab26bda0c")] on line 25

   7.b-  /AnnouncementsModule.cs at line 490
              originally it says: public static readonly Guid ProductsPageGroupId = new Guid("F0EB1F97-6E95-455C-B349-86F4A25C75EB");

   7.c-  /AnnouncementsModule.cs at line 495
              originally it says: public static readonly Guid HomePageId = new Guid("21848245-6CB3-41F0-8A87-487B459914EB");

   7.d-  /AnnouncementsModule.cs at line 500
              originally it says: public static readonly Guid CommentsPageId = new Guid("BB493061-3BF7-4920-AACA-44A35DF5742C");


   7.e-  /AnnouncementsModule.cs at line 524
              originally it says: public static readonly Guid ColorsTaxonomyId = new Guid("47FC0316-0F9B-4D6D-A606-6CDC1977E10D");

* to create a random GUID value, you can use visual studio's built-in GUID generator which is located at menu bar Tools/Create GUID

ps: if you are having hard time finding the lines, you can perform a search for --- Guid("  --- phrase in the file; it is how I find the lines..

An alternative: I have written an application which performs case sensitiv find and replaces BOTH on file contents AND on file and folder names... I will create another post in this forum which will contain a better template project (better in terms of naming, not code content) and I will include the sitefinityModuleRenamer application and a video which will demostrate creating a module using this configuration

Feel free too ask anything,
Cheers,
Cihan

This thread is closed