The razor-converter is a simple tool for converting Microsoft® ASP.NET MVC WebForms Views to the new Razor syntax. It was initially developed by the Telerik ASP.NET MVC team for internal use, but it now lives its own life on GitHub.
- The tool only works with views and does not deal with the project structure and master pages.
- Expressions in script tags are not converted
- Due to the differences between the view engines the automatic conversion will sometimes fail or produce incorrect results. See the integration tests for specific scenarios that are not covered.
For general tips on converting WebForms Views to Razor see these blog posts:
- Introducing Razor
- Model directive support
- Server-side comments
- The syntax
- Implicit and explicit code nuggets
- Introducing Razor (by Andrew Nurse)
Command line usage:
aspx2razor <input file / wildcard> [output-directory] [options]
Options: -r: Convert directories and their contents recursively (Contributed by Jeffrey T. Fritz)
A file with cshtml extension will be created for each input file. Existing files will be OVERWRITTEN so be careful.