I was trying to open an asp.net web application project on my Visual Studio 2010 RTM. I was not upgrade to ASP.NET 4. Then I press Build (F6), I got the following error:
CS0433: The type 'System.Web.Routing.RouteValueDictionary' exists in both 'c:\Windows\assembly\GAC_MSIL\System.Web.Routing\3.5.0.0__31bf3856ad364e35\System.Web.Routing.dll' and 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Web.dll'.
I've just found that Visual Studio 2010 using .NET 4's aspnet_compiler.exe to build this website.
If I don't want to upgrade the project to the ASP.NET 4, a.k.a. keep the current web.config content as usual. Is it possible to choose .NET 2.0's aspnet_compiler.exe to build this website? Or is there any workaround for this problem?
Do you have .NET 3.5 Sp1 framework installed on your box - this is
required for you to be able to target .NET 2.0 using VS 2010. When you open your solution for the first time using VS 2010, then during conversion, Visual Studio will prompt you to check whether you would like to upgrade your .NET framework to 4.0 or remain
targeting the lower framework. See the section on conversion in
this post.
Is it still upgrading you to 4.0 and you get the error on F6 even after you do the above? Feel free to email me a zip file of your project to : balach AT microsoft DOT com, and I can take a look into it.
Thanks,
Bala Chirtsabesan
Tester, Visual Web Developer Team
4. During Visual Studio Convertion Wizard, please choose "No" to keep project as .NET 3.5 target.
5. Run Build (F6) command and see the Output Windows then you'll see the error message.
Notes:
I was look into Kigg.Web.csproj file that there is a build target's AfterBuild event has been defined. When MvcBuildView is true, it will use AspNetCompiler to build the web project.
Then the 2.0 compiler will run and your site should build without errors. I double checked on this solution and got no errors so if you are still seeing issues let me know.
Then using Visual Studio 2010 open the "MvcApplication2.sln" solution and please don't upgrade to ASP.NET 4.
Then just press Build (F6).
Then you will see the error in the output window:
---
MvcApplication2 -> c:\Users\will\Documents\Visual Studio 2010\Projects\MvcApplication2\MvcApplication2\bin\MvcApplication2.dll
c:\Users\will\Documents\Visual Studio 2010\Projects\MvcApplication2\MvcApplication2\Views\Home\About.aspx(10): error CS0433: The type 'System.Web.Routing.RouteValueDictionary' exists in both 'c:\Program Files (x86)\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'
---
You may also want to check the "MvcApplication2.csproj" project file. I do put your recommandation on Line 117.
Hi Will, can you try this out? This should ensure that the correct exe is run. Substitute the toolpath with the location of your 2.0 framework directory. The snippet I tried is below and I could compile a project that previously displayed the error you are
talking about:
Doggy8088
Member
41 Points
110 Posts
Unable to build ASP.NET 2.0 web application under Visual Studio 2010
Apr 26, 2010 04:24 PM|LINK
I was trying to open an asp.net web application project on my Visual Studio 2010 RTM. I was not upgrade to ASP.NET 4. Then I press Build (F6), I got the following error:
CS0433: The type 'System.Web.Routing.RouteValueDictionary' exists in both 'c:\Windows\assembly\GAC_MSIL\System.Web.Routing\3.5.0.0__31bf3856ad364e35\System.Web.Routing.dll' and 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Web.dll'.
I've just found that Visual Studio 2010 using .NET 4's aspnet_compiler.exe to build this website.
If I don't want to upgrade the project to the ASP.NET 4, a.k.a. keep the current web.config content as usual. Is it possible to choose .NET 2.0's aspnet_compiler.exe to build this website? Or is there any workaround for this problem?
Thanks!
</div>Visual Studio 2010 ASP.NET
http://blog.miniasp.com/
BalaMC
Member
164 Points
29 Posts
Re: Unable to build ASP.NET 2.0 web application under Visual Studio 2010
Apr 26, 2010 06:26 PM|LINK
Do you have .NET 3.5 Sp1 framework installed on your box - this is required for you to be able to target .NET 2.0 using VS 2010. When you open your solution for the first time using VS 2010, then during conversion, Visual Studio will prompt you to check whether you would like to upgrade your .NET framework to 4.0 or remain targeting the lower framework. See the section on conversion in this post.
Is it still upgrading you to 4.0 and you get the error on F6 even after you do the above? Feel free to email me a zip file of your project to : balach AT microsoft DOT com, and I can take a look into it.
Thanks,
Bala Chirtsabesan
Tester, Visual Web Developer Team
Doggy8088
Member
41 Points
110 Posts
Re: Unable to build ASP.NET 2.0 web application under Visual Studio 2010
Apr 26, 2010 11:42 PM|LINK
Hi Bala,
I do have .NET 3.5 SP1 installed. I'm using Windows 7 Ultimate (x64).
You can download source code from here: http://kigg.codeplex.com/SourceControl/changeset/changes/38916 ( KiGG - Change Set 38916 )
Here is the problem repro. procedure:
1. Unzip Kigg-38916.zip
2. Open Visual Studio 2010 (RTM)
3. Open Solution File "v2.x\KiGGEF.sln"
4. During Visual Studio Convertion Wizard, please choose "No" to keep project as .NET 3.5 target.
5. Run Build (F6) command and see the Output Windows then you'll see the error message.
Notes:
I was look into Kigg.Web.csproj file that there is a build target's AfterBuild event has been defined. When MvcBuildView is true, it will use AspNetCompiler to build the web project.
<Target Name="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(ProjectDir)\..\Web" />
</Target>
http://blog.miniasp.com/
joecar
Member
524 Points
120 Posts
Microsoft
Re: Unable to build ASP.NET 2.0 web application under Visual Studio 2010
May 03, 2010 06:38 PM|LINK
You will want to run the 2.0 version of the compiler since you are not targeting 4.0. To do so you can edit this section like so:
<Target Name="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
<AspNetCompiler VirtualPath="temp" TargetFrameworkMoniker=".NETFramework,Version=v2.0" PhysicalPath="$(ProjectDir)\..\Web" />
</Target>
Then the 2.0 compiler will run and your site should build without errors. I double checked on this solution and got no errors so if you are still seeing issues let me know.
Thanks,
Joe
Doggy8088
Member
41 Points
110 Posts
Re: Unable to build ASP.NET 2.0 web application under Visual Studio 2010
May 04, 2010 06:33 AM|LINK
Hi Joe,
I've tried many times and many ways but still can't let Visual Studio 2010 choose .NET 2.0's aspnet_compiler.exe to build my website.
Here is my code snippets in my *.csproj file:
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" /> <Target Name="AfterBuild" Condition="'$(MvcBuildViews)'=='true'"> <AspNetCompiler VirtualPath="temp" PhysicalPath="$(ProjectDir)\..\Web" TargetFrameworkMoniker=".NETFramework,Version=v2.0" /> </Target>I don't have any clue about this. Can you give me a hint? Thanks!
http://blog.miniasp.com/
Doggy8088
Member
41 Points
110 Posts
Re: Unable to build ASP.NET 2.0 web application under Visual Studio 2010
May 04, 2010 06:42 AM|LINK
Hi Joe,
I've made a little project to reproduce this problem.
Please download this project: http://dl.dropbox.com/u/1011445/temp/MvcApplication2.zip
Then using Visual Studio 2010 open the "MvcApplication2.sln" solution and please don't upgrade to ASP.NET 4.
Then just press Build (F6).
Then you will see the error in the output window:
---
MvcApplication2 -> c:\Users\will\Documents\Visual Studio 2010\Projects\MvcApplication2\MvcApplication2\bin\MvcApplication2.dll
c:\Users\will\Documents\Visual Studio 2010\Projects\MvcApplication2\MvcApplication2\Views\Home\About.aspx(10): error CS0433: The type 'System.Web.Routing.RouteValueDictionary' exists in both 'c:\Program Files (x86)\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'
---
You may also want to check the "MvcApplication2.csproj" project file. I do put your recommandation on Line 117.
Thanks for your help!
http://blog.miniasp.com/
joecar
Member
524 Points
120 Posts
Microsoft
Re: Unable to build ASP.NET 2.0 web application under Visual Studio 2010
May 07, 2010 05:37 PM|LINK
Hi Will, can you try this out? This should ensure that the correct exe is run. Substitute the toolpath with the location of your 2.0 framework directory. The snippet I tried is below and I could compile a project that previously displayed the error you are talking about:
<Target Name="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
<AspNetCompiler ToolPath="C:\Windows\Microsoft.NET\Framework\v2.0.50727" VirtualPath="temp" PhysicalPath="$(ProjectDir)\..\Web" />
</Target>
Thanks,
Joe
Doggy8088
Member
41 Points
110 Posts
Re: Unable to build ASP.NET 2.0 web application under Visual Studio 2010
May 08, 2010 06:53 AM|LINK
Hi Joe,
It works. Thank you very much. :-)
http://blog.miniasp.com/