Razor View Engine

Oct 21, 2010 at 12:19 PM

Playing with the .8 build (dev) and noticed a lot of cshtml going on.

I am assuming we are asp.net 4, and mvc 2. Is this correct?

If we are mvc 2, how can you integrate the Razor view engine into visual studio. Would be nice to have the highlighting / intellisense.

Is it safe to install mvc 3 previews and still work in 2?



Oct 21, 2010 at 5:27 PM
Edited Oct 21, 2010 at 5:28 PM

That actually is MVC 3. I don't know of any issue between 2 and 3 but you might want to ask the MVC team to be on the safe side. For highlighting and IntelliSense, the VS team is working on it right now.

Oct 22, 2010 at 1:49 PM

MVC 3 is actually in beta phase with "go live" approval so it should be fairly stable. I  haven't noticed any problems with my current enviroment after installing MVC 3 beta bits.

Oct 23, 2010 at 4:01 AM

Is MVC 3 beta supposed to have Razor editor support in Visual Studio? For me it didn't!

Oct 23, 2010 at 7:37 AM

Not yet, no.

Oct 23, 2010 at 8:33 AM

Can I ask, what editor do you use in the team to code in Razor? WebMatrix?

Oct 23, 2010 at 8:45 AM

Visual Studio – as html, xml, or text

Oct 24, 2010 at 9:07 AM

After I installed ASP.NET MVC 3 Beta, I'm getting the following error when loading the Orchard solution:

One or more projects in the solution were not loaded correctly. Please see the Output Window for details.

error  : The project file 'Orchard.Web\Modules\Orchard.Email\Orchard.Email.csproj' cannot be opened.
error  : The project file 'Orchard.Web\Modules\Orchard.Search\Orchard.Search.csproj' cannot be opened.
error  : The project file 'Orchard.Web\Modules\Orchard.Widgets\Orchard.Widgets.csproj' cannot be opened.
error  : The project file 'Orchard.Web\Modules\Orchard.CodeGeneration\Orchard.CodeGeneration.csproj' cannot be opened.
error  : The project file 'Orchard.Web\Modules\Orchard.Experimental\Orchard.Experimental.csproj' cannot be opened.
error  : The project file 'Orchard.Web\Modules\Orchard.Migrations\Orchard.Migrations.csproj' cannot be opened.
error  : The project file 'Orchard.Web\Modules\Contrib.DateTimeField\Contrib.DateTimeField.csproj' cannot be opened.
The project type is not supported by this installation.

I even tried installing MVC 3 after uninstalling/reinstalling Visual Studio but I'm still getting the same error. I can create new MVC 3 projects and everything works there but when loading Orchard.sln the above projects fail to load. Please help!

Oct 24, 2010 at 11:40 PM

You have a mismatch between the version of MVC 3 that you installed and the one that's used in the Orchard projects. Please check that you have the latest MVC 3 and the latest drop in the dev branch. Actually, not having MVC 3 installed at all will work too.

Oct 25, 2010 at 12:37 AM
Edited Oct 25, 2010 at 12:47 AM

I have ASP.NET MVC 3 Beta installed and synced to the latest drop, so not sure why I got that message.

But it worked after I deleted ProjectTypeGuids of {F85E285D-A4E0-4152-9332-AB1D724D3325} from the project files.

Oct 25, 2010 at 12:58 AM

OK, I found the problem. The projects that failed to open in VS have the ProjectTypeGuid of MVC 2 RTM in them, and I got the error message because I uninstalled MVC 2 after installing MVC 3 Beta.

ProjectTypeGuid for MVC 2 RTM is F85E285D-A4E0-4152-9332-AB1D724D3325

ProjectTypeGuid for MVC 3 Beta is E53F8FEA-EAE0-44A6-8774-FFD645390401

Replacing the guids in the csproj files will fix it.

Oct 26, 2010 at 2:42 AM

Thanks for fixing this in the source tree so quickly. I noticed that you removed the old guid without adding the MVC 3 guid. This seems to be disabling some MVC 3 tools in Visual Studio like the "Add view..." dialog, although the project works fine.