This project is read-only.

Cannot find custom tool 'RazorGenerator' on this system

Mar 14, 2013 at 2:09 AM
Edited Mar 14, 2013 at 2:13 AM
Hello All,

I'm running into problems trying to use this addin. This doesn't appear to be the same problem that another poster had reported. I'm running Visual Studio 2012 Premium on 64-Bit Windows 7 Pro.

I took the MVCPlugin project from CodeProject (which uses the original Single File MVC add-in) and I'm trying to convert it to use this new add-in. I installed 1.5.5.0 via NuGet and added it to all of my projects that have the controllers/models/views. I set the Custom Tool to 'RazorGenerator' in each of the .cshtml files.

When I right-click, then Run Custom Tool on the .cshtml file, it says 'Cannot find custom tool 'RazorGenerator' on this system'.

I opened the package console and 'Enable-RazorGenerator' ran with no errors. 'Redo-RazorGenerator' reported several of the same error (for each of the .cshtml files). So it looks like 'something' is installed...

If anyone can help me diagnose the problem so I can get this going, that would be appreciated.

Corey.
Mar 14, 2013 at 2:14 AM
Did you install the Razor Generator extension? The latest version is 1.5.4. Note that this is separate from installing the NuGet packages in your projects.
Mar 14, 2013 at 2:19 AM
That's what did it. Much obliged for the quick reply!
Mar 14, 2013 at 2:21 AM
Could you test it on a fresh clean MVC project, to isolate whether the issue relates to your existing solution?
Apr 2, 2013 at 10:39 PM
I had the same issue yesterday and turned out RazorGenerator.Mvc 1.5.5.0 was the culprit. It did not work on either VS2010 or VS2012. I had to fall back to 1.5.4.0 and everything worked perfectly.
Apr 3, 2013 at 1:28 AM
That seems unlikely to be the problem, because RazorGenerator.Mvc is only used at runtime, while the issue above sounds like something at generation time. So it should only be affected by the VSIX and not by any of the NuGet packages.

I just updated my test project to the latest everythin and I'm not seeing this.
Apr 5, 2013 at 11:06 PM
Not sure if this may help, but there are some confusing links and how-to's out there!
To get the razor generator working you have to install 2 things:
1) The Visual Studio Add-in "Razor Generator" NOT "Razor Single File Generator for MVC" - If you end up installing the second, then you get then RazorGenerator can't be found when the custom tool is run on the cshtml files (obviously because it's the wrong extension!).
2) The RazorGenerator.Mvc Nuget package.

Once both are installed and Visual Studio is restarted, all is well.

A couple of the more confusing links out there:
http://visualstudiogallery.msdn.microsoft.com/69fbf312-3843-4105-8b3f-f019bd8717d0?SRC=VSIDE
http://visualstudiogallery.msdn.microsoft.com/f28290ce-d987-4f91-b034-707031e10ce6

Maybe it's just me, but I'm still not sure how those 2 links and the right RazorGenerator are related!

Hope that helps. Thanks David for a great contribution!

Eric
Apr 6, 2013 at 12:31 AM
Yes, these links are to unrelated (albeit similar) projects. Yes, it's confusing but we don't control those! :)
Apr 8, 2013 at 5:39 PM
I see the the whole picture now...
  1. The Razor Generator extension must be installed to enable precompiled views generation for the entire solution at design time (via Tools->Extension Manager in VS2010, Tools->Extensions and Updates in VS2012, and the current version is 1.5.4).
  2. The RazorGenerator.Mvc Nuget package must be installed on each plugin to add the RazorGeneratorMvcStart.cs file, which injects the PrecompiledMvcEngine to handle looking up precompiled views at runtime (via Manage NuGet Packages from the plugin project context menu, current version is 1.5.5.0).
Sorry for the confusion earlier and thanks Eric & David for your clarifications, your help is much appreciated.
John