views:

116

answers:

2

Hi,

I upgraded to VS 2010 Beta2. It upgraded my slns and csprojs when I opened them. When it asked me, I opted to stay in .net 3.5 to keep compatability

NOTE: the original project was build with MVC2 Preview2 - the exact same version as what comes with VS2010

However, when I try to build my Web project including the views, I run into some compiler errors.

I have a Pager.ascx that does some paging magic using RouteValueDictionary, but I get this error at build time.

Error 50 The type 'System.Web.Routing.RouteValueDictionary' exists in both 'c:\Program Files\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.Web.dll' and 'c:\Windows\assembly\GAC_MSIL\System.Web.Routing\3.5.0.0__31bf3856ad364e35\System.Web.Routing.dll' c:\Projects\Phase2\Source\Kk.Web\Views\Shared\Pager.ascx 8 Kk.Web

MvcBuildViews is true inside the project file.

How do I fix this build error?

I somehow need to tell the ASPX compiler to be v3.5 (or v2.0, not sure). But I don't know how to do this.

Any help is greatly appreciated.

CV

+1  A: 

according to this article you need to have it change the AspNetCompiler physical path like so:

<Target Name="BuildViews" Condition="'$(MvcBuildViews)'=='true'" AfterTargets="Build">
  <Message Importance="normal" Text="Precompiling views" />
  <AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
</Target>
Maslow
Thanks for your answer, but it didn't solve my problem.I revisited this problem and found a solution from VSConnect. See my other answer.
CVertex
A: 

I revisited this problem and thanks to Maslow, I was able to google better and find this Microsoft Connect bug.

http://connect.microsoft.com/VisualStudio/feedback/details/557798/visual-studio-2010-compile-asp-net-3-5-website-using-net4s-aspnet-compiler-exe

The work around suggested on that issue works perfectly.

The solution is listed here, http://forums.asp.net/p/1551418/3824696.aspx

CVertex