I don't believe that you can use .cshtml files as Web forms user controls. However, you can add a .cshtml file to a Web forms app and reference it as the src of an iframe:
Make sure you change the profile to one of your choice, otherwise you will be greeted by my ugly mug. You also need to add references to System.Web.Razor, which you will find in Program Files -> Microsoft ASP.NET -> ASP.NET Web Pages -> v1.0 -> Assemblies.
you should also use Nuget to obtain Microsoft.Web.Helpers, which you can copy to the bin directory.
Mikesdotnett...
All-Star
154955 Points
19872 Posts
Moderator
MVP
Re: Can I use WebMatrix (razor ) and Visual Studio on same application?
Nov 16, 2010 10:14 PM|LINK
I don't believe that you can use .cshtml files as Web forms user controls. However, you can add a .cshtml file to a Web forms app and reference it as the src of an iframe:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title></title> </head> <body> @Twitter.Profile("mikesdotnetting") </body> </html>Make sure you change the profile to one of your choice, otherwise you will be greeted by my ugly mug. You also need to add references to System.Web.Razor, which you will find in Program Files -> Microsoft ASP.NET -> ASP.NET Web Pages -> v1.0 -> Assemblies. you should also use Nuget to obtain Microsoft.Web.Helpers, which you can copy to the bin directory.
WOMM :o)
Beginning ASP.NET Web Pages with WebMatrix | My Site | Twitter