Questions tagged [itemgroup]
56 questions
22
votes
2 answers
Empty an MSBuild ItemGroup
Is there a way to remove the contents of an ItemGroup without resorting to Targets? I'm looking for something equivalent to:
Thanks

Zain Rizvi
- 23,586
- 22
- 91
- 133
17
votes
1 answer
Transform an ItemGroup into a Delimited String
My question is almost identical to Create an ItemGroup of strings in MSBuild however the solution offered there still seems to carry over the existing delimiter. Here's a simplified snippet of what I'm attempting to do:
…

aolszowka
- 1,300
- 12
- 36
17
votes
1 answer
How to get all the metadata keys for any ItemGroup item?
Is there a way to get all the metadata keys associated with a given item?
I want to do something like the following.
Given:
val1
val2
val3
…

Zain Rizvi
- 23,586
- 22
- 91
- 133
12
votes
2 answers
MSBuild ItemGroup Include/Exclude pattern issue
Problem: an ItemGroups array isn't correctly build based on the value passed in the exclude attribute.
If you run this scrip it creates some sample file then tries to create an array called TheFiles based on the Include/Exclude attributes, problem…

Keith
- 785
- 1
- 8
- 20
9
votes
3 answers
Copy a single file in MSBuild without using Exec or ItemGroup
Is there any way to do this? I just need to copy a single file and thought there may be some syntax for the SourceFiles parameter of the Copy task that means you don't need to define an ItemGroup beforehand, I'd rather stick with ItemGroup than use…

Shaun
- 1,293
- 16
- 19
6
votes
1 answer
How to retrieve @(TargetOutputs) without performing a build
I'm implementing an MSBuild framework to drive the building and deployment of many projects organized as a hierarchy.
…

Maxime Labelle
- 3,609
- 2
- 27
- 48
6
votes
2 answers
MsBuild: Passing an ItemGroup with CallTarget
I'm having some problems witht the scoping of item groups I create in an MSBuild script. Basically, what I want to do is to have two different targets - let's call them RunUnitTests and RunIntegrationTests - that generate an item group called…

Tomas Aschan
- 58,548
- 56
- 243
- 402
6
votes
2 answers
MSBuild - ItemGroup of all bin directories within subdirectories
My Solution has multiple projects (and therefore subdirectories), and there is a 'bin' folder in each project folder.
I'm trying to create an ItemGroup in my MSBuild script that includes all these directories.
I thought this would be sufficient, but…

dark_perfect
- 1,458
- 1
- 23
- 41
5
votes
1 answer
MSBuild Metadata on joined item groups
I have two item groups that I wish to join:
A
…

sagie
- 2,998
- 3
- 22
- 31
5
votes
2 answers
Removing a trailing slash in MSBuild / Convention based filename generation
I'm trying to search for a set of assemblies based on the following convention within a directory:
{SubDirName}\{SubDirName}.dll
I've started by creating an MSBuild ItemGroup [by batching another ItemGroup on the .RecursiveDir…

Ruben Bartelink
- 59,778
- 26
- 187
- 249
5
votes
1 answer
Cannot add item to itemgroups if itemchange() is defined (PyQt)
I'm building a PyQt QGraphicsView project where some QGraphicItems can be moved around between different QGraphicsItemGroups. For that, I use the addItemToGroup() method of the "new" parent itemGroup.
This works fine, but only so long as I do not…

Christian Zöllner
- 51
- 3
5
votes
2 answers
3
votes
1 answer
Referencing well-known item metadata inside metadata definition in an ItemGroup in a target
Here's an MSBuild script:
…

axk
- 5,316
- 12
- 58
- 96
3
votes
2 answers
msbuild include / copy from subdirectory to root directory - possible?
Can I include a file from a subdirectory, but have it placed in the root directory of the bulid instead of its original sub directory?
Example: We have multiple robots.txt files for different release configurations. The files are in the solution as…

dah97765
- 679
- 1
- 13
- 29
3
votes
2 answers
PackageReference condition is ignored for old project format
I'm trying to centralize some of our project configurations by using the Directory.Builds.props/Directory.Build.targets files. Unfortunately we have a mixture of the old and new (sdk-style) project format. And not all of our projects can be…

Jörg Penndorf
- 71
- 2