34
votes

What happened to the TagBuilder class between ASP.NET MVC 3 beta and RC?

When compiling my project I get the error:

The type name 'TagBuilder' could not be found. This type has been forwarded to assembly 'System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.

However that assembly does not exist in the GAC (nor in the .NET tab of the Add References dialog.) A search of my HDD doesn't turn up a DLL with that name either.

5
I'm experiencing the same issue with ASP.NET MVC 3 RTM while trying to compile an ASP.NET MVC 2 project. This is a major breaking change, and it's disappointing that Microsoft did this. Now I can't do MVC 3 development on the same box or release any builds until we get all of our developers' machines (and servers) to have ASP.NET MVC 3 installed.Paul
I had this trouble when upgrading a project from MVC2 to MVC3 using VS11. Had to clean, close and re-open the solution before the project would build without giving this error.Derrick

5 Answers

47
votes

On my install of the RC, that assembly lives here:

C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\System.Web.WebPages.dll
20
votes

It was moved to the System.Web.Pages.dll assembly:

c:\Program Files\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\
3
votes

FYI: C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\System.Web.WebPages.dll

is where it got installed by default on my Windows 7 Ultimate Box

3
votes

In Visual Studio 2012, I added this reference by going to the Reference Manager for the project (right click on References in the project and select Add Reference). Filtering by Assemblies and then Extensions (that is the important part), and adding System.Web.WebPages.

2
votes

In VS 2010 SP1, Microsoft added a new feature to copy these assemblies locally into your project (and source control). This way, the application can run on servers without needing to install MVCx. Right-click on the project, and choose "Add Deployable Dependencies..." and select the MVC checkbox. System.Web.WebPages will be pulled into your project.

Check out this article here that goes into more detail: Adding-mvc-dependencies-to-project