Search

MVC 2 does not work with ActionLink by Sean Hederman

Closed
as Fixed Help for as Fixed

1
0
Sign in
to vote
Type: Bug
ID: 539378
Opened: 3/4/2010 10:04:28 PM
Access Restriction: Public
1
Workaround(s)
0
User(s) can reproduce this bug
Create a new ASP.NET MVC 2 Empty Web Application does not work, has references still to .NET 3.5 DLL's which cannot be referenced via the Add Reference dialog
Details (expand)

Product Language

English

Version

Visual Studio 2010 Release Candidate

Operating System

Windows 7

Operating System Language

English

Steps to Reproduce

Create a new ASP.NET MVC 2 Empty Web Application
Add a HomeController, two views, Index.aspx and Test.aspx, and add their actions to the controller
In the default view place the following code:
<%= Html.ActionLink("Test", "Test") %>
Execute the web page

Actual Results

Server Error in '/' Application.

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0012: The type 'System.Web.Routing.RouteValueDictionary' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

Source Error:


Line 9: <body>
Line 10: <div>
Line 11: <%= Html.ActionLink("Test", "Test") %>
Line 12: </div>
Line 13: </body>

Source File: c:\Projects\MvcApplication1\MvcApplication1\Views\Home\Index.aspx Line: 11

Expected Results

A web page with a hyperlink to Test
      You can indicate your satisfaction with how Microsoft handled this issue by completing this quick 3 question survey. [Details]

 

File Attachments
0 attachments
Sign in to post a comment.
Posted by Tentome on 3/10/2010 at 9:00 AM
I came to this same error by starting with an empty MVC 2 project. Happened when I added new controlers and routes in Global.asax.cs.
Posted by Microsoft on 3/8/2010 at 10:47 AM
Hi Sean,

This issue was present in the Visual Studio 2010 Release Candidate and has since been fixed. The issue was only with the "Empty ASP.NET MVC 2 Application" project template and should not affect the non-empty project template. The workaround is to manually add back the references to System.Web.Abstractions and System.Web.Routing to the web.config file. You can find the proper web.config entries in the non-empty project's web.config file.

Thank you for the bug report and sorry for any inconvenience!

Thanks,
The ASP.NET Team
Posted by Microsoft on 3/7/2010 at 11:42 PM
Thank you for reporting the issue.
We are routing this issue to the appropriate group within the Visual Studio Product Team for triage and resolution.These specialized experts will follow-up with your issue.
Posted by Microsoft on 3/5/2010 at 7:01 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.
Posted by Dana Pellerin - CMC on 3/17/2010 at 7:29 AM
As mentioned in the comments, there's a few assembly references missing from the project template. here are the missing lines:

<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />