Visual Studio Razor Extension
Possibility to work with Tridion content in Microsoft Visual Studio:
- Edit razor code for Razor Mediator TBBs
- Synchronize *.cshtml files with Tridion
- Create Tridion Component Templates and Page Templates from Visual Studio automatically
- Synchronize Visual Studio binaries (*.css, *.js, *.jpg, *.png, etc.) with Tridion multimedia components
- Microsoft Visual Studio 2010 / 2012 /2013 installed on local machine
- Tridion CM 2013 or 2013 SP1 with Razor Mediator 1.3.x installed on a local or remote machine
Pass all steps.
Create new or open existing ASP.NET MVC application in Visual Studio. You will notice new extension in Tools menu
You can use dialog window for adjusting VS/TCM mapping and to run VS/TCM synchronization
You can use context menu on item or folder in Solution Explorer to run VS/TCM synchronization
* All mapping info is stored in TridionRazorMapping.xml file in project root.
Select folders on TCM side. Remember about BluePrint, select folder in top-level publication.
Every Tridion folder must have one of next roles:
- PageLayoutContainer. Folder that contains Razor Mediator TBBs for page layouts.
- ComponentLayoutContainer. Folder that contains Razor Mediator TBBs for components.
- PageTemplateContainer. Folder that contains Page Templates.
- ComponentTemplateContainer. Folder that contains Component Templates.
- MultimediaComponentContainer. Folder that contains Multimedia Components.
- Other. No synchronization actions defined for this folder.
By default synchronization works only in VS -> TCM direction. To run two-way synchronization, please use Two-way checkbox.
* TCM -> VS synchronization is more time-consuming, since TCM folders are scanned for new items.
Visual Studio mapping
Select folders from Visual Studio MVC project.
Use double-clicks to edit existing folder settings or button �Add� to add new folder.
In this dialog you can change folder and file settings
- Role. Select project folder role:
If files of different purpose are mixed in the same folder on file system you can map this folder twice and select only files of specific type. All checked files inherit role from parent folder.
- PageLayout. Folder contains *.cshtml files for page templates.
- ComponentLayout. Folder contains *.cshtml files for component templates.
- Binary. Folder contains binaries (*.jpg, *.png, *.js, *.css, etc)
- Other. Folder action is not defined.
- Template. Whether to create page or component template after razor file was synchronized to Razor TBB. (Only PageLayout and ComponentLayout roles)
- Tridion Folder. If you have more than one Tridion folder you can select to which folder synchronize.
- Template Format. Piece of XML like next
It is used to create Compound Templates (page or component) from Razor TBB. All checked files inherit role from parent folder.
- Schema Names. List of schema names to link to Component Compound Template on creating.
You can run synchronization in three ways:
- Dialog window � �Run Synchronization�.
Runs synchronization for all mapped Tridion and project folders.
- Item exists only in project. User will be prompted to enter name of new Tridion item select publication
- Item exists only in Tridion (two-way must be enable for Tridion folders(s))
User will be prompted to enter name of new project item and select project folder to place it.
- Item exists in both project and Tridion. Application compare dates and suggests user which version to use.
* It is important to select proper time zone to have a proper time comparison
User can make decision which version to use
* You won�t lose your previous changes. If you synchronize Tridion item from project then new Tridion item version will be created, and you will be able to roll it back. If your project item will be overwritten by Tridion item then you can use your version control system to roll it back (please check in project before run synchronization)
Context menu on file(s)
This kind of synchronization will synchronize only selected items.
* Note that context synchronization will be run for all mappings!
* TCM -> VS synchronization is not possible to be run from context menu.
If item is not mapped to any folder you will get message and synchronization will be canceled.
Context menu on folder
Work with Razor Mediator files
To provide Visual Studio compatibility for Razor Mediator files next conditions should be followed:
Next web.config file must be present in parent project folder
Add declaration to the top of razor file
If Razor Mediator file was crated from Tridion TBB by synchronizations then project changes 1 - 3 are made automatically by the application.
If file is created in Visual Studio please remember about requirements 1 - 3.
The project is available on Google code as an open source project where you can report issues and download the latest source code and installer.