Bug 37977 - C# consoleApp template doesn't build if .NET 4.5.1 is not installed (but 4.5 is)
Summary: C# consoleApp template doesn't build if .NET 4.5.1 is not installed (but 4.5 is)
Status: VERIFIED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Project Model ()
Version: Trunk
Hardware: PC Windows
: Normal normal
Target Milestone: C7SR1
Assignee: Lluis Sanchez
URL:
: 40479 ()
Depends on:
Blocks:
 
Reported: 2016-01-25 06:27 UTC by Andres G. Aragoneses
Modified: 2016-07-26 16:50 UTC (History)
6 users (show)

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


Attachments
screenshot of the problems (46.04 KB, image/png)
2016-01-25 06:27 UTC, Andres G. Aragoneses
Details
Log file (109.89 KB, text/plain)
2016-01-25 10:32 UTC, Andres G. Aragoneses
Details
Log file (58.59 KB, text/plain)
2016-07-24 22:36 UTC, gserg.g
Details


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:
VERIFIED FIXED

Description Andres G. Aragoneses 2016-01-25 06:27:03 UTC
Created attachment 14708 [details]
screenshot of the problems

Just downloaded XS6.0 Preview 3 (build 3668) for Windows and:

1. File -> New -> Solution
2. Choose "Other -> .NET" in the left panel.
3. "Console Project" will be highlighted in the list.
4. Choose C# language on the combobox.
5. Click on Next button, give a name for solution and project, click Create button.

Current results:
1. The C# file has many errors underlined in the editor as red colour. (When you hover over them they say in the tooltip "Error: Predefined type 'System.Object' is not defined or imported.", "Error: Predefined type 'System.String' is not defined or imported.", etc). [See screenshot]
2. If you build the project, the result is 1 error, but the content of the error is not shown. The build output doesn't show anything of relevance either. [See screenshot]

Expected results:
1. Should not have visual underlined errors in the editor.
2. Should build without errors.
Comment 1 Andres G. Aragoneses 2016-01-25 10:32:20 UTC
Created attachment 14710 [details]
Log file

Attaching log file. I think the relevant bit is this:

ERROR [2016-01-25 13:05:15Z]: Build failed.
System.InvalidOperationException: No compatible framework found for assembly 'C:\Program Files (x86)\Xamarin Studio\bin\MSBuild\dotnet.14.0\MonoDevelop.Projects.Formats.MSBuild.exe' (required framework: .NETFramework,Version=v4.5.1)
Comment 2 Lluis Sanchez 2016-02-04 11:04:05 UTC
You need the latest MS build tools. This is now checked by the installer.
Comment 3 Andres G. Aragoneses 2016-02-12 04:07:17 UTC
> You need the latest MS build tools. This is now checked by the installer.

Hey Lluis :) That cannot be the problem since I already have them installed, since you told me to in bug 35978 ;)
Comment 4 Lluis Sanchez 2016-02-12 10:10:21 UTC
Which .NET framework version do you have installed?
Comment 5 Andres G. Aragoneses 2016-02-12 10:21:04 UTC
> Which .NET framework version do you have installed?

C:\>dir /ad /b C:\Windows\Microsoft.NET\Framework
URTInstallPath_GAC
v1.0.3705
v1.1.4322
v2.0.50727
v3.0
v3.5
v4.0.30319
Comment 6 Andres G. Aragoneses 2016-02-12 10:34:39 UTC
However, my VS2012 can actually target the .NET4.5 framework:

C:\>dir "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\
 Volume in drive C is OS
 Volume Serial Number is 68A4-D643

 Directory of C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework

08/20/2014  12:32 PM    <DIR>          .
08/20/2014  12:32 PM    <DIR>          ..
08/20/2014  12:32 PM    <DIR>          v3.5
08/20/2014  12:35 PM    <DIR>          v4.0
08/20/2014  12:34 PM    <DIR>          v4.5
               0 File(s)              0 bytes
               5 Dir(s)  801,121,689,600 bytes free

C:\>dir "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5
 Volume in drive C is OS
 Volume Serial Number is 68A4-D643

 Directory of C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.N
ETFramework\v4.5

08/20/2014  12:34 PM    <DIR>          .
08/20/2014  12:34 PM    <DIR>          ..
07/09/2012  12:40 AM            26,560 Accessibility.dll
12/12/2011  11:51 AM            48,911 Accessibility.xml
07/09/2012  12:40 AM            41,424 CustomMarshalers.dll
12/12/2011  11:51 AM            11,092 CustomMarshalers.xml
08/20/2014  12:31 PM    <DIR>          Facades
07/09/2012  12:40 AM            42,424 ISymWrapper.dll
03/15/2012  08:37 PM            53,587 ISymWrapper.xml
07/09/2012  12:40 AM            27,128 Microsoft.Activities.Build.dll
06/15/2012  02:01 PM             5,233 Microsoft.Activities.Build.xml
07/09/2012  12:40 AM            38,408 Microsoft.Build.Conversion.v4.0.dll
12/12/2011  11:51 AM             6,393 Microsoft.Build.Conversion.v4.0.xml
07/09/2012  12:40 AM           406,984 Microsoft.Build.dll
07/09/2012  12:40 AM           216,040 Microsoft.Build.Engine.dll
06/15/2012  02:01 PM           158,764 Microsoft.Build.Engine.xml
07/09/2012  12:40 AM            54,768 Microsoft.Build.Framework.dll
06/15/2012  02:01 PM           178,333 Microsoft.Build.Framework.xml
07/09/2012  12:40 AM           473,080 Microsoft.Build.Tasks.v4.0.dll
06/15/2012  02:01 PM           487,482 Microsoft.Build.Tasks.v4.0.xml
07/09/2012  12:40 AM            96,264 Microsoft.Build.Utilities.v4.0.dll
06/15/2012  02:01 PM           176,859 Microsoft.Build.Utilities.v4.0.xml
06/15/2012  02:01 PM           311,523 Microsoft.Build.xml
07/09/2012  12:40 AM            49,104 Microsoft.CSharp.dll
06/15/2012  02:01 PM            18,141 Microsoft.CSharp.xml
07/09/2012  12:40 AM           130,512 Microsoft.JScript.dll
etc...
Comment 7 James Moore 2016-02-24 19:06:10 UTC
I can repro something that's possibly the same issue just by creating a new project:

http://autode.sk/1p1R91A
Comment 9 Lluis Sanchez 2016-05-09 07:54:16 UTC
*** Bug 40479 has been marked as a duplicate of this bug. ***
Comment 10 Lluis Sanchez 2016-06-20 13:05:41 UTC
Fixed in version 6.0.2.25 (cycle7)

Author: Lluis Sanchez
Commit: 7663ed860c78dfd1454fe49338be193fb4e2592b (mono/monodevelop)

Fixed in version 6.1.0.4969 (master)

Author: Lluis Sanchez
Commit: 98299ddb17d4bbfb08ca036edcdb4531cc300b6d (mono/monodevelop)
Comment 11 Saurabh 2016-06-27 11:53:54 UTC
I am also able to reproduce this Issue with XS 6.0(Build 3192), this is the screencast for the same: http://www.screencast.com/t/SfAdXAIaj

I have checked the same with latest master build XS 6.1 (Build 5052), project getting build successfully no error appears when .NET 4.5.1 is not installed.

I'll verify the Issue once fix will be merge in C7SR1.
Comment 12 Saurabh 2016-06-28 11:22:29 UTC
I checked this Issue with latest Cycle 7 build (XS 6.0.2.25), Project getting build successfully when .NET 4.5.1 is not installed. Build Output: https://gist.github.com/saurabh360/77f6591cd8a96cdd6eaef73f20aafa4a
Comment 13 gserg.g 2016-07-24 22:36:37 UTC
Created attachment 16774 [details]
Log file
Comment 14 gserg.g 2016-07-24 22:37:30 UTC
I've just updated to the stable 6.0.1 and I'm having this issue.

The XS installer successfully installed MSBuild 2013 and 2015.

I do not have .NET 4.5.1 installed, and I can't install it because I have .NET 4.6.1, and if I try to run the 4.5.1 installer, I get an error message saying I already have a newer version of .NET.

XS does not see any .NET types, the assembly browser shows no types at all.

I cannot build any of the existing Android solutions, neither can I build a new Android project if I create one. I also don't see a rollback option.

Restarting XS, as suggested in http://forums.xamarin.com/discussion/66875/build-failed-see-the-build-log-for-details-after-it-was-updated-newest-version-xamarin, does not help.

This thread seems to describe the problem exactly: https://forums.xamarin.com/discussion/61938/unregistered-targetframework-netframework-version-v4-5-1-is-being-requested-from. It seems abandoned.

Repairing XS as suggested does not work.

Attaching my log with errors. Apart from the F# messages that I lack, it looks very much like the log posted by Andres G. Aragoneses.
Comment 15 gserg.g 2016-07-24 22:50:20 UTC
I am an idiot and I missed "Fixed in version 6.0.2.25"
The stable version is 6.0.1.

Still, it does not feel right that a month after the issue was identified, a "stable" version with this bug (or is it Bug 41658?) is still offered.
It's not a minor issue, it completely destroys development process, and there is no easy rollback.
Comment 16 Kyle White 2016-07-26 15:55:40 UTC
@gserg, 

Our current Beta is very close to Stable and should have this issue resolved. Can you try the Beta builds? You can get it by switching your channel to Beta in the XS updater window.

Kyle
Comment 17 gserg.g 2016-07-26 16:50:03 UTC
@Kyle Yes, the beta build works.