Bug 1862 - ItemGroup inside Target is not supported
Summary: ItemGroup inside Target is not supported
Status: RESOLVED FIXED
Alias: None
Product: Tools
Classification: Mono
Component: xbuild ()
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: Martin Baulig
URL:
Depends on:
Blocks:
 
Reported: 2011-11-03 15:17 UTC by Bojan Rajkovic [MSFT]
Modified: 2013-06-14 21:58 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 Bojan Rajkovic [MSFT] 2011-11-03 15:17:05 UTC
If an ItemGroup is placed inside a Target block in an MSBuild task, the following error is always encountered:

/path/to/project.sln (default targets) ->
(Build target) ->
/path/to/project.csproj (default targets) ->
(AfterBuild target) ->

	: error : Error initializing task ItemGroup: Not registered task ItemGroup.

Moving the ItemGroup(s) back to the top level fixes it, but also causes Visual Studio to display the items in the solution explorer twice. MonoDevelop doesn't suffer from the issue, but when both are used interchangeably, it's cosmetically quite ugly.
Comment 1 Bojan Rajkovic [MSFT] 2011-11-03 15:17:52 UTC
This bug is also tracked in the Novell bugzilla at https://bugzilla.novell.com/show_bug.cgi?id=643399, but has no additional information.
Comment 2 Andres G. Aragoneses 2012-09-17 08:55:54 UTC
FYI I committed a partial fix for this in https://github.com/mono/mono/commit/aaa61ce6b9fca782e835c263cc251080771e8936 .

So it doesn't break the build anymore, although the ItemGroup is not evaluated yet (for the evaluation part of this missing bugfix I introduced a NotWorking testcase here: https://github.com/mono/mono/commit/8ed93b10f0f4f977cee3dfe4d2ca957c6ebe8a3d )
Comment 3 Martin Baulig 2013-03-25 22:34:00 UTC
I need this feature urgently, so I'll implement this.
Comment 4 Mikayla Hutchinson [MSFT] 2013-03-26 03:43:12 UTC
Could you do PropertyGroup too while you're at it? :)

One difficult part of this is making sure conditions work correctly - on the group, the items, and the metadata. The other is batching.
Comment 5 Martin Baulig 2013-03-26 22:26:18 UTC
Yeah, sure.  I've already done PropertyGroup and conditions.  Just need to write some more tests and implement that new "remove" feature.   What do you mean with batching ?
Comment 6 Mikayla Hutchinson [MSFT] 2013-03-27 00:04:08 UTC
Batching is like a sort of comprehension across a set of items.

http://msdn.microsoft.com/en-us/library/ms171473(v=vs.80).aspx
Comment 7 Bojan Rajkovic [MSFT] 2013-06-14 18:56:57 UTC
Martin, is this implemented?
Comment 8 Martin Baulig 2013-06-14 21:58:33 UTC
Yes.