Bug 5890 - ASP.NET MVC3 Template can be created with invalid project options (that result in a failure to build)
Summary: ASP.NET MVC3 Template can be created with invalid project options (that resul...
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: ASP.Net ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: sparek
URL:
Depends on:
Blocks:
 
Reported: 2012-06-27 14:20 UTC by PJ
Modified: 2012-07-16 03:12 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description PJ 2012-06-27 14:20:10 UTC
This template seems to only exist on Windows.


Building Solution: TIMES (Debug)

Building: TIMES (Debug)
Generating CodeBehind members...
No changes made to CodeBehind classes.
Performing main compilation...
C:\Windows\Microsoft.NET\Framework\v3.5\csc.exe /noconfig "/r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll"
 -nostdlib
 "/out:C:\Users\puppetmaster\Documents\Projects\TIMES\TIMES\bin\TIMES.dll"
 "/r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll"
 "/r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Web.dll"
 "/r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll"
 "/r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll"
 "/r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Web.Services.dll"
 "/r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Web.Routing.dll"
 "/r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Web.Extensions.dll"
 "/r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Web.Abstractions.dll"
 "/r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Web.DynamicData.dll"
 "/r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.ComponentModel.DataAnnotations.dll"
 "/r:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll"
 /nologo
 /warn:4
 /debug:full
 /optimize-
 "/define:DEBUG"
 
 /t:library
 "C:\Users\puppetmaster\Documents\Projects\TIMES\TIMES\Controllers\HomeController.cs"
 "C:\Users\puppetmaster\Documents\Projects\TIMES\TIMES\Global.asax.cs"
 /fullpaths
 /utf8output
 
c:\Users\puppetmaster\Documents\Projects\TIMES\TIMES\Controllers\HomeController.cs(5,18): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
c:\Users\puppetmaster\Documents\Projects\TIMES\TIMES\Controllers\HomeController.cs(6,18): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
c:\Users\puppetmaster\Documents\Projects\TIMES\TIMES\Controllers\HomeController.cs(10,32): error CS0246: The type or namespace name 'Controller' could not be found (are you missing a using directive or an assembly reference?)
c:\Users\puppetmaster\Documents\Projects\TIMES\TIMES\Global.asax.cs(7,18): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
c:\Users\puppetmaster\Documents\Projects\TIMES\TIMES\Controllers\HomeController.cs(12,10): error CS0246: The type or namespace name 'ActionResult' could not be found (are you missing a using directive or an assembly reference?)
c:\Users\puppetmaster\Documents\Projects\TIMES\TIMES\Global.asax.cs(26,45): error CS0246: The type or namespace name 'GlobalFilterCollection' could not be found (are you missing a using directive or an assembly reference?)



Build complete -- 6 errors, 3 warnings

---------------------- Done ----------------------

The reference 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' is not valid for the target framework of the project.
The reference 'System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' is not valid for the target framework of the project.
The reference 'System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' is not valid for the target framework of the project.
Build: 6 errors, 3 warnings


Environment:
Windows 7-32 bit
.Net 4.5 & .Net 4.0
MD 3.0.3.3 & 3.0.3.2
MFA 4.2.4



This template is not present on 3.0.2
Comment 1 sparek 2012-06-28 05:36:07 UTC
I have the same environment (Win7 32, .NET 4.0 & 4.5, MD 3.0.3.2) and the only way I was able to reproduce the error was to change the default target framework from 4.0 to 3.5 in the project’s options. Since Mvc 3 isn't available on .net 3.5, some assemblies are missing and hence the build failed. Are you sure nothing was changed in the build options? The new mvc templates have target framework set to 4.0 by default, so they should build with no errors.
Comment 2 PJ 2012-06-28 17:50:01 UTC
I too can successfully build if I select Mono / .NET 4.0, but for me, the Mono / .NET 3.5 option is selected by default: http://screencast.com/t/9zuwuGCtP

My installed .NET:

Microsoft .NET Framework 4.5 RC
Microsoft .NET Framework 4 Multi-Targeting Pack

This machine was 64 bit, but the 360logica team experienced this on the environments listed.


Let me know if there's any more information I can provide!
Comment 3 sparek 2012-06-29 04:25:18 UTC
Just to be sure it’s not related to MD options – could you check your project file format for new projects (Tools -> Options -> Load/Save: "Project file format to use when creating new projects"). If it’s not set to "MSBuild (Visual Studio 2010)", then MD automatically set target framework to a  lower version (3.5 when you have VS 2008 chosen) so that the project is compatible with earlier versions of Visual Studio.
Comment 4 PJ 2012-07-02 17:45:31 UTC
That's exactly what happened. Thanks.

Perhaps the bug then would be that there should be an error message or a prompt that indicates the incompatibility between project options and project type. Lowering to enhancement and I've changed the title to indicate this.
Comment 5 PJ 2012-07-02 17:46:28 UTC
Also confirming again.
Comment 6 sparek 2012-07-16 03:12:21 UTC
Done.