Search code examples
asp.net-mvcentity-framework-4.1asp.net-mvc-scaffolding

MVCScaffolding ' Invoke-ScaffoldTemplate : Error HRESULT E_FAIL COMException '?


All of a sudden I am getting the following from my MVCScaffolding command in PMC :

Invoke-ScaffoldTemplate : Error HRESULT E_FAIL has been returned from a call to a COM component.
At line:1 char:23
+ param($c, $a) return . <<<<  $c @a
    + CategoryInfo          : NotSpecified: (:) [Invoke-ScaffoldTemplate], COMException
    + FullyQualifiedErrorId : T4Scaffolding.Cmdlets.InvokeScaffoldTemplateCmdlet

Haven't changed anything much since last ran successfully, and this error doesn't give me much info.

Any ideas?


Solution

  • Ahhh ha. For me this was a ridiculously simple one, just a scary error. Not sure why Google gave me nothing on this...

    I had added the solution to source control in TFS, and the file the T4 was trying to edit was not checked out ! So...

    1. Simply check out the target file
    2. Or even better, use the Set-IsCheckedOut as per Useful T4Scaffolding cmdlets for use in custom scaffolders

    Simplesh !