The custom tool 'RazorGenerator' failed. The method or operation is not implemented
Asked Answered
M

5

11

I have just upgraded the Visual Studio extension RazorGenerator to V1.5 (Last updated 10/14/2012) and now have the following problems.

Each cshtml file edited now removes the generated file, if I choose to 'Run Custom Tool' I get The custom tool 'RazorGenerator' failed. The method or operation is not implemented.

I had it working previously in my project without issue but the upgrade seems to have broken it. Does anyone know how this can be fixed..? I can't even seem to roll back to the previous version now since it's installed via the ExtensionManager.

The latest version of RazorGenerator.MVC in nuget is 1.4 (Friday, April 20, 2012) so perhaps the version mismatch is the issue..?

I have tried restarting VS and my machine without success, I even un-installed the extension and re-installed and that also didn't work.

Exception calling "RunCustomTool" with "0" argument(s): "The custom tool 'RazorGenerator' failed.  The method or operation is not implemented."
At D:\Source\MySolution\MyProject\packages\RazorGenerator.Mvc.1.4.0.0\tools\RazorGenerator.psm1:32 char:32
+         $_.Object.RunCustomTool <<<< ()
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ComMethodTargetInvocation

Exception calling "GetItem" with "1" argument(s): "The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))"
At D:\Source\MySolution\MyProject\packages\RazorGenerator.Mvc.1.4.0.0\tools\RazorGenerator.psm1:62 char:46
+                     $solutionExplorer.GetItem <<<< ("$SolutionName\$ProjectName$relativePath").UIHierarchyItems.Expanded = $false
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ComMethodTargetInvocation

In addition to this, I get the following build errors for each view (despite saying build succeeded):

Custom tool error: Could not load file or assembly 'file:///C:\Users\Rob\AppData\Local\assembly\dl3\VQ93NZJ0.M7K\4HA91P75.CHN\4b53b7b1\09b87db8_d4adcd01\RazorGenerator.Core.v1.dll' or one of its dependencies. The system cannot find the file specified.

I downloaded the source, built locally and copied the 'RazorGenerator.Core.v1.dll' into the directory from the error message but it still didn't work. I even copied all of the RazorGenerator*.dll files into that directory but still no luck. Checking the dependencies only shows system assemblies and 'RazorGenerator.Core.dll' which is present in the same directory.

Incidentally, the 'RazorGenerator.Core.dll' was already in the directory above.

Looking in the Visual Studio extensions folder I have a directory for RazorGenerator as follows:

C:\Users\Rob\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\RazorGenerator contributors\Razor Generator\1.5

The following files and assemblies are within this folder:

extension.vsixmanifest
RazorGenerator.Core.dll
RazorGenerator.Core.v1.dll
RazorGenerator.Core.V2.dll
RazorGenerator.dll
RazorGenerator.pdb
RazorGenerator.pkgdef

Any help would be very much appreciated.

Ma answered 19/10, 2012 at 13:13 Comment(3)
It seems your are not the only one with this problem: razorgenerator.codeplex.com/workitem/72Separatist
Thanks, I didn't spot that before. Added to the discussion.Ma
I was having the same problem, and I just got it working by copying everything from the visual studio extension folder to the assembly folder, including RazorGenerator.Core.DLL, the manifest, and the pkgdef. Give that a try?Repentant
M
14

I was hoping for a better answer to this but since this solves the problem then I figured I should post it.

Basically @Bobson was right, creating a copy of the files in the directory solved it. In my case doing a copy/paste of the RazorGenerator.Core.v1.dll assembly from

C:\Users\Rob\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\RazorGenerator contributors\Razor Generator\1.5

to

C:\Users\Rob\AppData\Local\assembly\dl3\VQ93NZJ0.M7K\4HA91P75.CHN\4b53b7b1\09b87db8_d4adcd01

This gave me 3 files in that directory:

__AssemblyInfo__.ini
RazorGenerator.Core.dll
RazorGenerator.Core.v1.dll

I didn't notice that this had solved the issue at first because it also requires a re-start of visual studio.

The work item hasn't been picked up yet but ultimately if you have this issue then copying the files over and re-starting should fix it.

Ma answered 30/10, 2012 at 17:0 Comment(1)
Here's a quick Linqpad snippet I wrote to automate this task as it seemed to be happening all the time for me - gist.github.com/geoffappleford/6087882Ehrman
M
5

For anyone else who gets stuck here in VS2012 - the suggestions here worked for me with a couple caveats:

  • My extension folder was some auto-generated name, not pretty like above:

%USERPROFILE%\AppData\Local\Microsoft\VisualStudio\11.0\Extensions\qd42h302.z0o

  • In that folder, I found only the RazorGenerator.Core.dll and RazorGenerator.dll. I copied both over (and the extension.vsixmanifest and RazorGenerator.pkgdef). Then, I had two folders underneath v1 and v2. Since the current version of RazorGenerator.Mvc is 1.5.5.0 at the time of this writing, I assumed that v2 is a next release.

This is not so. I also had to copy the \v2\RazorGenerator.Core.V2.dll into the local assembly directory:

%USERPROFILE%\AppData\Local\assembly\dl3\VVGKRX56.ODL\P1CK8APX.LRJ\1188e83c\133862b8_6531ce01

  • Now I have both. In the codeplex post, pranavkmwr mentions choosing the version based on the Razor that you are using. I guess those version numbers refer to the razor engine, no the RazorGenerator version.
Myrtlemyrvyn answered 4/4, 2013 at 19:13 Comment(1)
Here's a quick Linqpad snippet I wrote to automate this task as it seemed to be happening all the time for me - gist.github.com/geoffappleford/6087882Ehrman
R
3

Although not an answer to this specific problem, I was having a similar issue where I was receiving this error:

The custom tool 'RazorGenerator' failed. The method or operation is not implemented.

as well as having my Razor Generator delete files instead of generating them. I didn't, however, get the error having to do with the missing assembly file.

My problem was some errant text that was accidentally added to the end of a web.config file, apparently making it invalid and causing the aforementioned issues. Fixing the web.config file fixed the problem. Hopefully this helps someone with a similar issue.

Ran answered 3/1, 2013 at 16:54 Comment(1)
Thanks for sharing, you saved my day! :)Mills
A
0

I fixed this problem on my system by simply uninstalling the RazorGenerator extension and restarting VS.

It didn't work the first couple of times I did it but I also had another instance of Visual Studio open in the background. So make sure you close all of your Visual Studio windows. You might also want to check the background processes to make sure none is still running.

Aboriginal answered 10/4, 2013 at 10:57 Comment(0)
D
0

In my case help closed all Visual Studio and open only one. It seems that this component have problem with more than one opened instance Visual Studio 2015.

Maybe it will help someone.

Droplet answered 3/8, 2016 at 22:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.