Closed andrewknightley closed 12 years ago
OK, just resolved this issue....
The problem is an out-of-date version of your scaffolding packages.
First of all you have to uninstall MvcScaffold and T4Scaffold packages with the Package Manager. Then (and this is the part most people with this problem are overseeing) remove the directories for these packages from the packages directory at solution level. MvcMailer.1.1 MvcScaffolding.1.0.6 T4Scaffolding.1.0.5
If you only remove the references to these packages at project level the fix doesn't work. This is the part that most online solutions miss out.
I got this to work by doing the following:
PM> Scaffold Mailer.Razor UserMailer Welcome,PasswordReset
This worked for me and the Mailer classes and views were properly generated.
I removed MVCMailer and re-install MVCMailer and update the old T4Scafolding to latest version 1.0.6. But it still didn't work. So I did the following and it worked for me: 1.Uninstall MVCMailer (and T4Scafolding) 2.Install T4Scafolding (Install-Package T4Scafolding) 3.Install MVCMailer (Install-Package MVCMailer)
tuntunwin's solution worked for me after a Visual Studio restart.
No matter what i do i just can't get this working, I ALWAYS get this error
I got the same issue here with the Visual Studio 2013 Ultimate Preview Edition. None of the workarounds is helping me :/
I am geting the same issue with the Visual Studio 2013 Ultimate Preview Edition, any help?
the same case here, i tried all the solutions but still not working :(
Is there an example somewhere on github with a fresh scaffold or two so I can manually create them? I don't have time to mess with the scaffolding command issues, just need to see come code. ;)
hey, you don't actully need to use scaffolding to use mvcmailer. It just generates some code to make it easy on you.
To use MVCMailer create these classes (for example to send a verification email)
Create folder on root called "Mailers" Create class UsersMailer.cs
Under Views create folder "UsersMailer" Create view "_Layout.cshtml" Create View "VerifyEmail.cshtml"
on your Web.config add your usual settings:
< system.net> < mailSettings> < smtp from="bla@blabla.com"> < network enableSsl="true" host="smtp.blamailprovider.com" port="587" userName="bla@blabla.com" password="myrandompassword"/> < /smtp> < /mailSettings> < /system.net>
On your VerifyEmail.cshtml: < p> Test mail body < /p>
On your _Layout.cshtml: < html> < head>< /head> < body> @RenderBody() < /body> < /html>
Finally your UsersMailer.cs: public class UsersMailer : MailerBase { public UsersMailer() { MasterName = "_Layout"; } public virtual MvcMailMessage VerifyEmail() { return Populate(x => { x.Subject = "Test subject"; x.ViewName = "VerifyEmail"; x.To.Add("recipent@bla.com"l); }); }
}
After that just cal l new UsersMailer().VerifyEmail() from somewhere in your code.
that's it
When using the scaffold command I get the following error, I'm using on a fresh C# project with both web application and MVC 3.0
PM> Scaffold Mailer UserMailer PasswordReset, PasswordNew Invoke-Scaffolder : A positional parameter cannot be found that accepts argument 'UserMailer'. At line:1 char:9
Thanks in advance