12

I'm trying to get MvcMailer working in a new MVC 4 Beta project (created just for trying this out), using the latest version of NuGet.

I get to the step

PM> Scaffold Mailer UserMailer Welcome,PasswordReset

At which point I see the error message:

Cannot resolve alias 'Scaffold' because it refers to term 'Invoke-Scaffolder', which is not recognized as a cmdlet, function, operable program, or script file. Verify the term and try again. At line:1 char:9 + Scaffold <<<< Mailer UserMailer Welcome,PasswordReset + CategoryInfo : ObjectNotFound: (Scaffold:String) [], CommandNotFoundException + FullyQualifiedErrorId : AliasNotResolvedException

Update: After installing MvcScaffolding (wasn't a NuGet prerequisite...), the error message for the same command changes to:

Invoke-Scaffolder : A positional parameter cannot be found that accepts argument 'UserMailer'. At line:1 char:9 + Scaffold <<<< Mailer UserMailer Welcome,PasswordReset + CategoryInfo : InvalidArgument: (:) [Invoke-Scaffolder], ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,T4Scaffolding.Cmdlets.InvokeScaffolderCmdlet

How can I resolve this issue?

Eric J.
  • 147,927
  • 63
  • 340
  • 553

7 Answers7

22

I had the same issue, to fix it I updated the Scaffolding packages (T4 in one occasion, T4 + MVCScaffolding on another), and restarted VS.

update-package T4Scaffolding

and / or

Update-Package MvcScaffolding

remember to restart VS afterward.

brainless
  • 5,698
  • 16
  • 59
  • 82
Segev -CJ- Shmueli
  • 1,535
  • 14
  • 15
  • I get further after installing MvcScaffolding (it was not installed... did I miss that in the docs? Certainly wasn't a NuGet prereq), but now get the error `Invoke-Scaffolder : A positional parameter cannot be found that accepts argument 'UserMailer'.` Any thoughts? – Eric J. Apr 25 '12 at 04:15
  • Never mind, found the follow-on issue (see my separate answer). – Eric J. Apr 25 '12 at 04:24
  • I was about to refer you to Eric's response before realizing you are the same person :) .... After your comment I looked again at my code and realized that I've set Razor as my default scaffolder, guess i forgot to mention it.. Apologies. – Segev -CJ- Shmueli May 07 '12 at 04:52
  • Also see the issue on the MvcMailer site for further discussion: https://github.com/smsohan/MvcMailer/issues/33 – moonpatrol May 18 '12 at 02:23
  • Updating T4Scaffolding and installing MvcScaffolding worked for me – Phil Hale Sep 05 '12 at 08:20
  • I had to downgrade T4Scaffolding from version 1.0.6 to version 1.0.5. The package folder of version 1.0.6 did not contain the T4Scaffolding.dll file. After installing 1.0.5 the Scaffold cmdlet was available again. – Alexander van Trijffel Sep 19 '12 at 12:40
  • For anyone attempting to get this working under Window 8 / VS2012, the new versions of MvcScaffolding 1.0.8 (https://nuget.org/packages/MvcScaffolding/) and T4Scaffolding 1.0.7 (https://nuget.org/packages/T4Scaffolding) solve the preview version of PowerShell issue. – Maurice Butler Sep 26 '12 at 09:57
  • Thank you very much. Your solution worked perfectly. The issue is resolved by Update-Package MvcScaffolding – Ali Jan 01 '13 at 10:27
6

Segev's answer is correct as far as the original question goes.

It turns out that the scaffolding command also changed, causing the follow-on error. The correct scaffolding command is:

Scaffold Mailer.Razor UserMailer Welcome,PasswordReset

From

https://github.com/smsohan/MvcMailer/issues/37

Eric J.
  • 147,927
  • 63
  • 340
  • 553
3

I had similar issues. The reason was I ignored the following prompt after T4Scaffolding upgrade:

A different version of T4Scaffolding is already running in this instance of Visual Studio Please restart Visual Studio to avoid unexpected behavior. You won't be able to use scaffolding until you restart Visual Studio.

It was absolutely crucial to restart Visual Studio, then everything went on smoothly.

3

I had problems updating the T4Scaffolding package. It's because I had two T4Scaffolding folders in my Packages folder (T4Scaffolding.1.0.6 & T4Scaffolding.1.0.7). I renamed the 1.0.6 to _T4Scaffolding1.0.6 and everything worked well after that.

YeeHaw1234
  • 2,358
  • 1
  • 17
  • 16
3

What worked for me is this:

  1. Un-install MvcMailer.
  2. Un-install MvcScaffolding and T4Scaffolding.
  3. Set the correct Default Project in Package Manager Console.
  4. Run this from command Install-Package MvcScaffolding -Version 1.0.8-vs2013 -Pre as mentioned by Scott himself here.
  5. Install MvcMailer through Nuget.
  6. Run this command Scaffold Mailer.Razor UserMailer Welcome,PasswordReset
Community
  • 1
  • 1
gsk
  • 1,233
  • 15
  • 32
  • 4
    This is the only way I got it to work on Windows 8.1 Visual Studio 2013. AND You must run VS as administrator. As I found, you can't turn off UAC in Win 8.1 to avoid "run as administrator". – Phil M Apr 10 '14 at 09:41
  • Yup, This is indeed the only way that worked for me too with Windows 8.1 and VS 2013.Thanks a lot for this help since I tried with almost all possibilities but nothing was working. – Saroj Sep 10 '14 at 07:57
2

Anyone who still gets this issue after tried all above

You need to install Windows Management Framework 3.0 (http://www.microsoft.com/en-us/download/confirmation.aspx?id=34595)

T4Scaffolding.DLL is looking for System.Management.Automation, Version=3.0.0.0

I just did no more Scaffolding error.

ycs
  • 77
  • 1
  • 4
0

I got this error also. "Invoke-Scaffolder : A positional parameter cannot be found that accepts argument ..." For me just closing VS12 and reopening fixed it. Strange.

Grayson
  • 191
  • 1
  • 9