The following forum(s) have migrated to Microsoft Q&A (Preview): Azure App Service - Web Apps!
Visit Microsoft Q&A (Preview) to post new questions.

Learn More

 locked
Tutorial Problem: Deploy a Secure ASP.NET MVC 5 app with Membership, OAuth, and SQL Database to a Windows Azure Web Site RRS feed

  • Question

  • In the new tutorial (http://www.windowsazure.com/en-us/develop/net/tutorials/web-site-with-sql-database/) using VS2013 I get a syntax error when asked to add the AddUserAndRole() method in the Migrations.Configuration.cs file.

    The lines of code which fail are:

                var um = new UserManager<ApplicationUser>(
                    new UserStore<ApplicationUser>(new ApplicationDbContext()));
    

    There are 18 syntax errors associated with the line:


    Error	1	A new expression requires (), [], or {} after type	c:\users\anton\documents\visual studio 2013\Projects\ContactManager\ContactManager\Migrations\Configuration.cs	27	37	ContactManager
    Error	2	A new expression requires (), [], or {} after type	c:\users\anton\documents\visual studio 2013\Projects\ContactManager\ContactManager\Migrations\Configuration.cs	28	30	ContactManager
    Error	3	) expected	c:\users\anton\documents\visual studio 2013\Projects\ContactManager\ContactManager\Migrations\Configuration.cs	28	33	ContactManager
    Error	4	Invalid expression term ')'	c:\users\anton\documents\visual studio 2013\Projects\ContactManager\ContactManager\Migrations\Configuration.cs	28	81	ContactManager
    Error	5	; expected	c:\users\anton\documents\visual studio 2013\Projects\ContactManager\ContactManager\Migrations\Configuration.cs	28	81	ContactManager
    Error	6	Using the generic type 'Microsoft.AspNet.Identity.UserManager<TUser>' requires 1 type arguments	c:\users\anton\documents\visual studio 2013\Projects\ContactManager\ContactManager\Migrations\Configuration.cs	27	26	ContactManager
    Error	7	The name 'lt' does not exist in the current context	c:\users\anton\documents\visual studio 2013\Projects\ContactManager\ContactManager\Migrations\Configuration.cs	27	38	ContactManager
    Error	8	Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement	c:\users\anton\documents\visual studio 2013\Projects\ContactManager\ContactManager\Migrations\Configuration.cs	27	41	ContactManager
    Error	9	'ContactManager.Models.ApplicationUser' is a 'type' but is used like a 'variable'	c:\users\anton\documents\visual studio 2013\Projects\ContactManager\ContactManager\Migrations\Configuration.cs	27	41	ContactManager
    Error	10	The name 'gt' does not exist in the current context	c:\users\anton\documents\visual studio 2013\Projects\ContactManager\ContactManager\Migrations\Configuration.cs	27	57	ContactManager
    Error	11	Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement	c:\users\anton\documents\visual studio 2013\Projects\ContactManager\ContactManager\Migrations\Configuration.cs	27	60	ContactManager
    Error	12	Using the generic type 'Microsoft.AspNet.Identity.EntityFramework.UserStore<TUser>' requires 1 type arguments	c:\users\anton\documents\visual studio 2013\Projects\ContactManager\ContactManager\Migrations\Configuration.cs	28	21	ContactManager
    Error	13	The name 'lt' does not exist in the current context	c:\users\anton\documents\visual studio 2013\Projects\ContactManager\ContactManager\Migrations\Configuration.cs	28	31	ContactManager
    Error	14	Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement	c:\users\anton\documents\visual studio 2013\Projects\ContactManager\ContactManager\Migrations\Configuration.cs	28	34	ContactManager
    Error	15	'ContactManager.Models.ApplicationUser' is a 'type' but is used like a 'variable'	c:\users\anton\documents\visual studio 2013\Projects\ContactManager\ContactManager\Migrations\Configuration.cs	28	34	ContactManager
    Error	16	The name 'gt' does not exist in the current context	c:\users\anton\documents\visual studio 2013\Projects\ContactManager\ContactManager\Migrations\Configuration.cs	28	50	ContactManager
    Error	17	Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement	c:\users\anton\documents\visual studio 2013\Projects\ContactManager\ContactManager\Migrations\Configuration.cs	28	53	ContactManager
    Error	18	Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement	c:\users\anton\documents\visual studio 2013\Projects\ContactManager\ContactManager\Migrations\Configuration.cs	28	80	ContactManager
    
    Thanks for your help.



    Anton

    Friday, October 25, 2013 4:25 AM

Answers

  • Hello,

    There is a formatting issue with the code on the tutorial page, it should be 

     var um = new UserManager<ApplicationUser>(
                    new UserStore<ApplicationUser>(new ApplicationDbContext()));

    Cheers,

    P.

    Friday, October 25, 2013 11:40 AM

All replies

  • Hi Anton,

    Thanks for posting!

    According your description, this issue seems like Azure Website, I will move your question to the Azure Website  forums, in there you will get a good reply from the Azure experts.

    Thanks

    Regards,

    Will


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, October 25, 2013 7:42 AM
    Moderator
  • Hello,

    There is a formatting issue with the code on the tutorial page, it should be 

     var um = new UserManager<ApplicationUser>(
                    new UserStore<ApplicationUser>(new ApplicationDbContext()));

    Cheers,

    P.

    Friday, October 25, 2013 11:40 AM