This project is read-only.

Calling RazorGenerator commands from code?

Nov 6, 2014 at 3:57 PM
Hi,

As the title would suggest, I was hoping I would be able to call the commands from code. I've tried using PowerShell but it says I'm in the wrong "host".

Would anybody happen to know of a way of doing this in C#? All I want to do is call "Get-Project -All | Enable-RazorGenerator" and "Get-Project -All | Redo-RazorGenerator"

Thanks in advance,
Rob
Nov 6, 2014 at 5:15 PM
I've tried using PowerShell but it says I'm in the wrong "host".
Is this using the package manager console?

You could write a Cmdlet in C# (see https://mvcscaffolding.codeplex.com/SourceControl/latest#T4Scaffolding.Core/Cmdlets/AddClassMemberCmdlet.cs), but you'd still have to invoke this using the package manager console. Alternatively you could write a VS extension and use it to automate the DTE in the same way the PS script does
Nov 6, 2014 at 5:30 PM
Hi,

No I was trying to call it from PowerShell itself when doing some tests.

It's ok - I mean I was hoping for a "Process.Start" type solution (like with MsBuild.exe or NuGet.exe) - but I guess it's more complex than that.

Rob