 |
BOOK: Beginning ASP.NET for Visual Studio 2015
 | This is the forum to discuss the Wrox book Beginning ASP.NET for Visual Studio 2015 by William Penberthy; ISBN: 978-1-119-07742-8 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning ASP.NET for Visual Studio 2015 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|
|

February 24th, 2016, 11:53 AM
|
|
Authorized User
|
|
Join Date: Jan 2016
Posts: 13
Thanks: 1
Thanked 1 Time in 1 Post
|
|
Hmm, no packages directory. That's interesting. When you start to build, do you get a dialogue box that talks about "Restoring NuGet Packages"?
Your problem with Razor will be because you do not have that .MVC package. If you do not see it as a listed option for update, try looking into the "Browse" section of the "Manage Packages for Solution" window and install it from there. Look for Microsoft.AspNet.MVC. (This will also add the Microsoft.AspNet.Razor package)
|
|

February 24th, 2016, 12:55 PM
|
|
Authorized User
|
|
Join Date: Feb 2016
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Now we are getting somewhere! But, not home yet...
I went into the NuGet Package Manager, manually updated Everything (there were 19 updates hanging, so much for automatic (?!), and went through "Browse" and added everything that looked like it might help; no specific MVC packages but Browse did Microsoft.AspNet.Mvc at 5.2, I updated it to 5.2.3 as well as the associated .WebApi (also 5.2.3, possibly synchronized..). .WebPages at 3.2.3 ...
Good news is the waterfall o'errors is gone (!!). Bad news is I get this:
Server Error in '/' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Default Role Provider could not be found.
Source Error:
Line 57: </providers>
Line 58: </profile>
Line 59: <roleManager>
Line 60: <!--
Line 61: ASP.NET Membership Role is disabled in this template. Please visit the following link http://go.microsoft.com/fwlink/?LinkId=301889 to learn about the ASP.NET Membership support in this template
Source File: D:\Web_Programming\Beginning_ASP-dot-NET\00_My_Version_1\Rent_My_Wrox_Scott_1\Rent_My_W rox_Scott_1\web.config Line: 59
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1038.0
The error list shows:
Unexpected "foreach" keyword after "@" character. Once inside code, you do not need to prefix constructs like "foreach" with "@". Rent_My_Wrox_Scott_1 D:\Web_Programming\Beginning_ASP-dot-NET\00_My_Version_1\Rent_My_Wrox_Scott_1\Rent_My_W rox_Scott_1\Views\UserDemographics\Index.cshtml.
Index.cshtml has a foreach loop that is preceded by an @, executed by a contitional @if (Model != null):
@foreach (var item in Model) .. that goes on to do DisplayFor methods for modelItem members.
Other than that, the no-includes error-rama is gone. Major headway!
Next?
scott
|
|

February 25th, 2016, 11:53 AM
|
|
Authorized User
|
|
Join Date: Jan 2016
Posts: 13
Thanks: 1
Thanked 1 Time in 1 Post
|
|
Por NuGet problems, maybe?
Take a look through the NuGet stuff (you should, unfortunately, be an expert at that by now!) and ensure that Microsoft.AspNet.Identity.Core, Microsoft.AspNet.Identity.EntityFramework, and Microsoft.AspNet.Identity.Owin are installed in your solution.
|
|

February 25th, 2016, 04:16 PM
|
|
Registered User
|
|
Join Date: Feb 2016
Posts: 6
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
Quote:
Originally Posted by cadtools
Error CS0012 The type 'Expression<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Rent_My_Wrox_Scott_1 D:\Web_Programming\Beginning_ASP-dot-NET\00_My_Version_1\Rent_My_Wrox_Scott_1\Rent_My_W rox_Scott_1\Views\UserDemographics\Index.cshtml
So, it appears the Razor calls are the cause of our grief..
|
So I am brand new to ASP (this book is teaching me) but I ran into this error in chapter 6. Googling gave me: http://stackoverflow.com/questions/3...not-referenced
After downgrading the NuGet package as mentioned in the first solution, this error vanished
I have no idea if that helps at all but since I spent the last 20 minutes figuring it out I figured it may be worth sharing.
|
|
The Following User Says Thank You to Shaitan For This Useful Post:
|
|
|

February 27th, 2016, 10:16 AM
|
|
Authorized User
|
|
Join Date: Feb 2016
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Installed Microsoft.AspNet.Identity.x from NuGet
Yes indeed, all 3 packages are installed, and at version 2.2.1. Would be nice to include a screen shot or attach a file with a screen shot..
|
|

February 27th, 2016, 05:02 PM
|
|
Authorized User
|
|
Join Date: Jan 2016
Posts: 13
Thanks: 1
Thanked 1 Time in 1 Post
|
|
Update Security?
I think those three packages should be at 3.0.1 or similar. Are you able to update those in our favorite Package Manager?
|
|

February 27th, 2016, 06:39 PM
|
|
Authorized User
|
|
Join Date: Feb 2016
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Microsoft.AspNet.Identity.xx versions
Version 2.2.1 is listed in Vs NuGet "installed" tab as the latest stable release (released April 2015).
A goolge hunt (bing under Edge gave a 404 (  )), 3.0.0-rc1-final is shown as a pre-release, Nov 18, 2015.
3.0.0 link:
https://www.nuget.org/packages/Micro...spNet.Identity
I am going back and reviewing chapters 1 thru 6 and re-building the project without the extra css, page1 page2 etc. exercises and just doing what will become the RentMyWrox application.. After I get to the end of chapter 6 (it has worked through chapter 5 without incident (!) I might try updating (and re-building, and re-starting system and VS) to 3.0.0 if I have errors after the re-coding of the assembly. That may point to what happens with 2.2.1 versus 3.0.0.
Stay Tuned..
scott
Last edited by cadtools; February 27th, 2016 at 06:45 PM..
Reason: typos
|
|

February 27th, 2016, 08:38 PM
|
|
Authorized User
|
|
Join Date: Feb 2016
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
A Major Success !
I did the update of the Microsoft.AspNet.Identity.xx packages to 3.0.0 -pre (supposedly removing the 2.2.3 versions) and got massive double-definition errors,after doing a clean and rebuild. I rolled those back to 2.2.3, still got a slew of errors. The I follower an earlier posters' suggestion of rolling back the Microsoft.AspNet.MVC package to 5.0.0 and IT WORKED.
The scary thing that has me distrusting Visual Studio and MVC is that 5.2.3 is listed as the "latest stable" version of that package, but the assembly will not build properly unless that package is rolled back to 5.2.0.
Anyway, I will now continue on.
scott
|
|

July 16th, 2016, 06:35 AM
|
|
Registered User
|
|
Join Date: Jul 2016
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Is there any solution for this error. I'm stuck.
And if I run the solution one more time I get the error that the ressource was not found like it can't find the /UserDemographics/Manage.
How do you correct this error.
Regards Allan
Quote:
Originally Posted by cadtools
Index.cshtml has many Razor calls that start:
@Html.DisplayNameFor(model => model.xx) and a foreach loop setting
@Html.DisplayFor(model => item.xx)
Each call generates the following error (squiggly underline in @xx name)
Error CS0012 The type 'Expression<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Rent_My_Wrox_Scott_1 D:\Web_Programming\Beginning_ASP-dot-NET\00_My_Version_1\Rent_My_Wrox_Scott_1\Rent_My_W rox_Scott_1\Views\UserDemographics\Index.cshtml
So, it appears the Razor calls are the cause of our grief..
Ideas? Again, the demo "Index" page from the online examples, chapter 6, works without the "create new" link working; create new generates this:
Server Error in '/' Application.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 78: @foreach (string hobby in hobbyList)
Line 79: {
Line 80: string checkedText = Model.Hobbies.Contains(hobby)
Line 81: ? "checked"
Line 82: : string.Empty;
Source File: D:\Web_Programming\Beginning_ASP-dot-NET\RentMyWrox_Chapter6_CSharp\RentMyWrox\RentMyWr ox\Views\UserDemographics\Manage.cshtml Line: 80
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
ASP._Page_Views_UserDemographics_Manage_cshtml.Exe cute() in D:\Web_Programming\Beginning_ASP-dot-NET\RentMyWrox_Chapter6_CSharp\RentMyWrox\RentMyWr ox\Views\UserDemographics\Manage.cshtml:80
System.Web.WebPages.WebPageBase.ExecutePageHierarc hy() +177
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +80
System.Web.WebPages.StartPage.RunPage() +47
System.Web.WebPages.StartPage.ExecutePageHierarchy () +71
System.Web.WebPages.WebPageBase.ExecutePageHierarc hy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +101
System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +312
System.Web.Mvc.BuildManagerCompiledView.Render(Vie wContext viewContext, TextWriter writer) +115
System.Web.Mvc.ViewResultBase.ExecuteResult(Contro llerContext context) +248
System.Web.Mvc.ControllerActionInvoker.InvokeActio nResult(ControllerContext controllerContext, ActionResult actionResult) +27
System.Web.Mvc.ControllerActionInvoker.InvokeActio nResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +58
System.Web.Mvc.ControllerActionInvoker.InvokeActio nResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +349
System.Web.Mvc.ControllerActionInvoker.InvokeActio nResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +69
System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInv okeAction>b__1c() +188
System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInv okeAction>b__1e(IAsyncResult asyncResult) +124
System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndD elegate(IAsyncResult asyncResult) +27
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End( ) +58
System.Web.Mvc.Async.AsyncResultWrapper.End(IAsync Result asyncResult, Object tag) +30
System.Web.Mvc.Async.AsyncControllerActionInvoker. EndInvokeAction(IAsyncResult asyncResult) +29
System.Web.Mvc.Controller.<BeginExecuteCore>b__1d( IAsyncResult asyncResult, ExecuteCoreState innerState) +27
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDel egate(IAsyncResult asyncResult) +48
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End( ) +58
System.Web.Mvc.Async.AsyncResultWrapper.End(IAsync Result asyncResult, Object tag) +30
System.Web.Mvc.Async.AsyncResultWrapper.End(IAsync Result asyncResult, Object tag) +21
System.Web.Mvc.Controller.EndExecuteCore(IAsyncRes ult asyncResult) +32
System.Web.Mvc.Controller.<BeginExecute>b__15(IAsy ncResult asyncResult, Controller controller) +26
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDel egate(IAsyncResult asyncResult) +40
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End( ) +58
System.Web.Mvc.Async.AsyncResultWrapper.End(IAsync Result asyncResult, Object tag) +30
System.Web.Mvc.Async.AsyncResultWrapper.End(IAsync Result asyncResult, Object tag) +21
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +29
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAs yncController.EndExecute(IAsyncResult asyncResult) +24
System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__ 5(IAsyncResult asyncResult, ProcessRequestState innerState) +27
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDel egate(IAsyncResult asyncResult) +48
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End( ) +58
System.Web.Mvc.Async.AsyncResultWrapper.End(IAsync Result asyncResult, Object tag) +30
System.Web.Mvc.Async.AsyncResultWrapper.End(IAsync Result asyncResult, Object tag) +21
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsync Result asyncResult) +29
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHan dler.EndProcessRequest(IAsyncResult result) +23
System.Web.CallHandlerExecutionStep.System.Web.Htt pApplication.IExecutionStep.Execute() +9742689
System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean& completedSynchronously) +155
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1038.0
Could this just be a folder name being too long?
|
|
|
 |
|