Bug 40628 - xbuild doesn't support project specific targets, e.g. "/t:SlnFolder\My_Project"
Summary: xbuild doesn't support project specific targets, e.g. "/t:SlnFolder\My_Project"
Alias: None
Product: Tools
Classification: Mono
Component: xbuild ()
Version: 4.4.0 (C7)
Hardware: All Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-04-21 23:05 UTC by Tom Philpot
Modified: 2018-03-15 10:40 UTC (History)
3 users (show)

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

Example solution which reproduces bug (8.23 KB, application/x-zip-compressed)
2016-04-21 23:05 UTC, Tom Philpot

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:

Description Tom Philpot 2016-04-21 23:05:54 UTC
Created attachment 15811 [details]
Example solution which reproduces bug

MSBuild supports building specific projects via the /t: argument, e.g. http://www.codeproject.com/Articles/654910/How-To-Build-A-Specific-Project-From-A-Solution-wi

Mdtool allows building a single project in a solution with project dependencies, platform and configuration settings from the solution file, e.g. mdtool build -p:MyProject -c:"Platform|Configuration"

This support prevents us from moving to XBuild (without using workarounds like custom properties or targets).

The following works with MSBuild 14.0:
MSBuild XBuildTestSolution.sln /t:Folder1\XBuild_1
MSBuild XBuildTestSolution.sln /t:Folder2\XBuild_2

Only building the entire solution works with xbuild:
xbuild XBuildTestSolution.sln

The following does not work:
xbuild XBuildTestSolution.sln /t:"Folder2\XBuild_2"
XBuild Engine Version 14.0
Mono, Version
Copyright (C) 2005-2013 Various Mono authors

Build started 4/21/2016 3:51:17 PM.
Project "/Volumes/C/Users/tom.philpot/Documents/Visual Studio 2015/Projects/XBuildTestSolution/XBuildTestSolution.sln" (Folder2\XBuild_2 target(s)):
	Target ValidateSolutionConfiguration:
		Building solution configuration "Debug|Any CPU".
/Volumes/C/Users/tom.philpot/Documents/Visual Studio 2015/Projects/XBuildTestSolution/XBuildTestSolution.sln: error : Target named 'Folder2\XBuild_2' not found in the project.
Done building project "/Volumes/C/Users/tom.philpot/Documents/Visual Studio 2015/Projects/XBuildTestSolution/XBuildTestSolution.sln".-- FAILED


/Volumes/C/Users/tom.philpot/Documents/Visual Studio 2015/Projects/XBuildTestSolution/XBuildTestSolution.sln (Folder2\XBuild_2) ->

	/Volumes/C/Users/tom.philpot/Documents/Visual Studio 2015/Projects/XBuildTestSolution/XBuildTestSolution.sln: error : Target named 'Folder2\XBuild_2' not found in the project.

	 0 Warning(s)
	 1 Error(s)

Time Elapsed 00:00:00.2515670

See attached zip file for the example solution tests case.
Comment 1 Tom Philpot 2016-04-27 16:50:11 UTC
This test project works successfully with MSBuild preview in Mono 4.4 for OSX (which will be a suitable work around once released)
Comment 2 Marek Safar 2018-03-15 10:40:00 UTC
We deprecated xbuild and recommend using msbuild instead. Switching to msbuild will also most likely resolve the issue you reported.