Bug 16791 - xbuild cannot build projects created by VS2013
Summary: xbuild cannot build projects created by VS2013
Status: RESOLVED FIXED
Alias: None
Product: Tools
Classification: Mono
Component: xbuild ()
Version: unspecified
Hardware: PC Mac OS
: High major
Target Milestone: ---
Assignee: Mikayla Hutchinson [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2013-12-13 19:31 UTC by Mikayla Hutchinson [MSFT]
Modified: 2014-03-03 14:35 UTC (History)
3 users (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 GitHub or Developer Community 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 Mikayla Hutchinson [MSFT] 2013-12-13 19:31:12 UTC
Projects created by VS2013 use the 12.0 ToolsVersion.

The following patch introduced ToolsVersion 12 to the xbuild core but did not actually add the 12.0 targets:
https://github.com/mono/mono/commit/b9a4200cae4334ccefe0ca6e41bbf08e79c096ad

So builds fail because the common targets cannot be found:

:  warning : Default tasks file MSBuild/12.0/bin/Microsoft.Common.tasks not found, ignoring.
/Users/michael/Mono/monodevelop/main/tests/test-projects/ConsoleApp-VS2013/ConsoleApplication.csproj:  warning : Could not find project file /Users/michael/Mono/monodevelop/main/tests/test-projects/ConsoleApp-VS2013/MSBuild/12.0/bin/Microsoft.CSharp.targets, to import. Ignoring.

Errors:

/Users/michael/Mono/monodevelop/main/tests/test-projects/ConsoleApp-VS2013/ConsoleApplication.sln (default targets) ->
(Build target) ->
/Users/michael/Mono/monodevelop/main/tests/test-projects/ConsoleApp-VS2013/ConsoleApplication.csproj (default targets) ->

	/Users/michael/Mono/monodevelop/main/tests/test-projects/ConsoleApp-VS2013/ConsoleApplication.csproj: error : Target named 'Build' not found in the project.
Comment 1 Mikayla Hutchinson [MSFT] 2014-01-07 22:25:14 UTC
Fixed by https://github.com/mono/mono/compare/c8a343cf30d9...91ed5dfbfc34
Comment 2 Tim Uy 2014-02-01 17:04:25 UTC
Does this mean the latest XS should build VS2013 PCLs again?
Comment 3 Mikayla Hutchinson [MSFT] 2014-02-01 17:57:12 UTC
Nope, this is a fix in Mono which should be shipped in Mono 3.2.7. Once it's shipped, command-line xbuild will be able to build ToolsVersion=12.0 files.

However, building ToolsVersion="12.0" project files in XS on Mac will require a new XS version updated to support loading the new version of xbuild. Unfortunately we can't implement this until Mono 3.2.7 is shipped.
Comment 4 Tim Uy 2014-02-01 23:13:12 UTC
I'm still not able to open my csproj in 4.2.3. If I re-create my project in Xamarin Studio, will I be able to build it in VS2013?

System.InvalidOperationException: Unknown file format: /Loqu8/Projects/sapatos/src/Sapatos/Sapatos.Core/Sapatos.Core.csproj
  at MonoDevelop.Projects.ProjectService.ReadFile (IProgressMonitor monitor, System.String file, System.Type expectedType, MonoDevelop.Projects.FileFormat& format) [0x00062] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.2.3-branch/2af56f42/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectService.cs:316 
  at MonoDevelop.Projects.ProjectService+<ReadSolutionItem>c__AnonStorey6A.<>m__35 (IProgressMonitor , System.String ) [0x0001f] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.2.3-branch/2af56f42/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectService.cs:209 
  at MonoDevelop.Projects.DefaultProjectServiceExtension.LoadSolutionItem (IProgressMonitor monitor, System.String fileName, MonoDevelop.Projects.Extensions.ItemLoadCallback callback) [0x00004] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.2.3-branch/2af56f42/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectService.cs:671 
  at MonoDevelop.Projects.ProjectServiceExtension.LoadSolutionItem (IProgressMonitor monitor, System.String fileName) [0x00019] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.2.3-branch/2af56f42/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:103 
  at MonoDevelop.Projects.ProjectServiceExtension.LoadSolutionItem (IProgressMonitor monitor, System.String fileName, MonoDevelop.Projects.Extensions.ItemLoadCallback callback) [0x00011] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.2.3-branch/2af56f42/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:94 
  at MonoDevelop.Projects.ProjectServiceExtension.LoadSolutionItem (IProgressMonitor monitor, System.String fileName) [0x00019] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.2.3-branch/2af56f42/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:103 
  at MonoDevelop.Autotools.MakefileProjectServiceExtension.LoadSolutionItem (IProgressMonitor monitor, System.String fileName) [0x00004] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.2.3-branch/2af56f42/source/monodevelop/main/src/addins/MonoDevelop.Autotools/MakefileProjectServiceExtension.cs:69 
  at MonoDevelop.Projects.ProjectServiceExtension.LoadSolutionItem (IProgressMonitor monitor, System.String fileName, MonoDevelop.Projects.Extensions.ItemLoadCallback callback) [0x00011] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.2.3-branch/2af56f42/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:94 
  at MonoDevelop.Projects.ProjectServiceExtension.LoadSolutionItem (IProgressMonitor monitor, System.String fileName) [0x00019] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.2.3-branch/2af56f42/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:103 
  at MonoDevelop.Projects.ProjectServiceExtension.LoadSolutionItem (IProgressMonitor monitor, System.String fileName, MonoDevelop.Projects.Extensions.ItemLoadCallback callback) [0x00011] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.2.3-branch/2af56f42/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:94 
  at MonoDevelop.Projects.ProjectServiceExtension.LoadSolutionItem (IProgressMonitor monitor, System.String fileName) [0x00019] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.2.3-branch/2af56f42/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:103 
  at MonoDevelop.Projects.ProjectServiceExtension.LoadSolutionItem (IProgressMonitor monitor, System.String fileName, MonoDevelop.Projects.Extensions.ItemLoadCallback callback) [0x00011] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.2.3-branch/2af56f42/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:94 
  at MonoDevelop.Projects.ProjectServiceExtension.LoadSolutionItem (IProgressMonitor monitor, System.String fileName) [0x00019] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.2.3-branch/2af56f42/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:103 
  at MonoDevelop.Projects.ProjectServiceExtension.LoadSolutionItem (IProgressMonitor monitor, System.String fileName, MonoDevelop.Projects.Extensions.ItemLoadCallback callback) [0x00011] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.2.3-branch/2af56f42/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:94 
  at MonoDevelop.Projects.ProjectServiceExtension.LoadSolutionItem (IProgressMonitor monitor, System.String fileName) [0x00019] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.2.3-branch/2af56f42/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:103 
  at MonoDevelop.Projects.ProjectServiceExtension.LoadSolutionItem (IProgressMonitor monitor, System.String fileName, MonoDevelop.Projects.Extensions.ItemLoadCallback callback) [0x00011] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.2.3-branch/2af56f42/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:94 
  at MonoDevelop.Projects.ProjectServiceExtension.LoadSolutionItem (IProgressMonitor monitor, System.String fileName) [0x00019] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.2.3-branch/2af56f42/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:103 
  at MonoDevelop.Projects.CompiledAssemblyExtension.LoadSolutionItem (IProgressMonitor monitor, System.String fileName) [0x00048] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.2.3-branch/2af56f42/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/CompiledAssemblyProject.cs:224 
  at MonoDevelop.Projects.ProjectServiceExtension.LoadSolutionItem (IProgressMonitor monitor, System.String fileName, MonoDevelop.Projects.Extensions.ItemLoadCallback callback) [0x00011] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.2.3-branch/2af56f42/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:94 
  at MonoDevelop.Projects.ProjectServiceExtension.LoadSolutionItem (IProgressMonitor monitor, System.String fileName) [0x00019] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.2.3-branch/2af56f42/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:103 
  at MonoDevelop.Projects.ProjectServiceExtension.LoadSolutionItem (IProgressMonitor monitor, System.String fileName, MonoDevelop.Projects.Extensions.ItemLoadCallback callback) [0x00011] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.2.3-branch/2af56f42/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:94 
  at MonoDevelop.Projects.ProjectServiceExtension.LoadSolutionItem (IProgressMonitor monitor, System.String fileName) [0x00019] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.2.3-branch/2af56f42/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:103 
  at MonoDevelop.Projects.ProjectServiceExtension.LoadSolutionItem (IProgressMonitor monitor, System.String fileName, MonoDevelop.Projects.Extensions.ItemLoadCallback callback) [0x00011] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.2.3-branch/2af56f42/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectServiceExtension.cs:94 
  at MonoDevelop.Projects.ProjectService.ReadSolutionItem (IProgressMonitor monitor, System.String file) [0x0007a] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.2.3-branch/2af56f42/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectService.cs:207 
  at MonoDevelop.Projects.SolutionFolder.AddItem (IProgressMonitor monitor, System.String filename, Boolean createSolutionConfigurations) [0x00015] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.2.3-branch/2af56f42/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionFolder.cs:304 
  at MonoDevelop.Ide.ProjectOperations.AddSolutionItem (MonoDevelop.Projects.SolutionFolder folder, System.String entryFileName) [0x0004e] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.2.3-branch/2af56f42/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs:731 
  at MonoDevelop.Ide.ProjectOperations.AddSolutionItem (MonoDevelop.Projects.SolutionFolder parentFolder) [0x0006a] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.2.3-branch/2af56f42/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs:711
Comment 5 Mikayla Hutchinson [MSFT] 2014-02-02 17:52:19 UTC
This bug is about xbuild, not Xamarin Studio. You probably want bug 16278. Did you follow my suggested workaround?
Comment 6 donsyme 2014-03-03 07:49:55 UTC
I can't compile F# VS2013 projects which have ToolsVersion=12.0.  This is using Mono 3.2.7. (I don't know if it was fixed with Mono 3.2.8)

Repro: 

1. Get any F# VS2013 project, e.g. the project at: 

 https://github.com/fsharp/fsharp/tree/master/tests/projects/Sample_VS2013_FSharp_ConsoleApp_net45

2. Compile it using Mono 3.2.7 "xbuild"

Observed: 
			Target CoreCompile: : error : Error initializing task Fsc: Not registered task Fsc.

3. Change ToolsVersion to 4.0  and rebuild

Observed: compiles OK.


Expected: ToolsVersion 12.0 compiles OK.
Comment 7 donsyme 2014-03-03 08:05:06 UTC
The problem seems to be because of the use of 

    Condition="Exists('$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll')"

in Microsoft.FSharp.Targets here:

https://github.com/fsharp/fsharp/blob/19786658cee582c26ade0eb7fa77cf1bf0c60330/src/fsharp/FSharp.Build/Microsoft.FSharp.Targets#L21

This condition must now be failing when ToolsVersion=12.0.  

The condition is not useful for F# so will be removed.  However this may still indicate a bug in the ToolsVersion=12.0 support.
Comment 8 Mikayla Hutchinson [MSFT] 2014-03-03 14:35:07 UTC
I would guess it's falling back to the 2.0 logic on ToolsVersion 12 and fails on xbuild because "$(MSBuildExtensionsPath32)\..\2.0\FSharp.Build.dll" is not installed on Mono.