itemgroup

Unwanted changes in .csproj file on build

戏子无情 提交于 2020-01-06 14:08:12
问题 I'm trying to auto-detect web.configs as part of a transform pre-build event in one of my web application project files, this code goes up one folder level from my project file and gets all web.configs in every directory and sub directory: <ItemGroup> <WebConfigsRelativePath Include ="..\**\Web.config"/> </ItemGroup> This works great but everytime I build and exit Visual Studio, I get a prompt asking me if I want to save changes made to my solution file. If I select yes, and open the project

how to get extension name (without dot) in MSBuild

青春壹個敷衍的年華 提交于 2019-12-24 01:02:44
问题 I have an ItemGroup, and I use its metadata as identifiers in my MSBuild project for batch processing. For example: <BuildStep TeamFoundationServerUrl="$(TeamFoundationServerUrl)" BuildUri="$(BuildUri)" Name="RunUnitTestsStep-%(TestSuite.Filename)-%(TestSuite.Extension)" Message=" - Unit Tests: %(TestSuite.Filename): %(TestSuite.Extension)"> <Output TaskParameter="Id" PropertyName="RunUnitTestsStepId-%(TestSuite.Filename)-%(TestSuite.Extension)" /> </BuildStep> However, this will not work,

echo All Elements of an ItemGroup

别说谁变了你拦得住时间么 提交于 2019-12-14 02:28:51
问题 I have an MSBuild ItemGroup and I would like to be able to echo it out in the "Post-Build Event". However when I try commands like: echo My ItemGroup: @(Foo) I get the error: error MSB4164: The value "echo My ItemGroup: @(Foo)" of metadata "Command" contains an item list expression. Item list expressions are not allowed on default metadata values. I'm not very good with ItemGroup s as of yet. Is there a way I can just echo the list of files that Foo contains? 回答1: You'll want something like:

Create an ItemGroup of strings in MSBuild

孤者浪人 提交于 2019-12-12 04:44:54
问题 I want to create an "ItemGroup" of arbitrary strings / names in order to use MSBuild transforms, for example: <ItemGroup> <Categories>First</Categories> <Categories>Second</Categories> </ItemGroup> I then wish to pass a transform of these categories into a console app, e.g.: /c @(Categories, ' /c ') The reason why I say "ItemGroup" in quotes, is because I'm not sure whether or not it is applicable for me to use ItemGroups in this way - as far as I can see nothing in the documentation states

MSBuild ItemGroup Include/Exclude pattern issue

醉酒当歌 提交于 2019-12-09 02:56:35
问题 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 is when the Exclude is anything other than hardcoded or a very simple property it gets it wrong. The target DynamicExcludeList's incorrectly selects these files: .\AFolder\test.cs;.\AFolder\test.txt The target HardcodedExcludeList's correctly

How to retrieve @(TargetOutputs) without performing a build

混江龙づ霸主 提交于 2019-12-04 01:30:21
问题 I'm implementing an MSBuild framework to drive the building and deployment of many projects organized as a hierarchy. <Target Name="_CoreBuild"> <MSBuild Projects="@(Project)" Targets="Build" Properties="Configuration=$(Configuration)"> <Output TaskParameter="TargetOutputs" ItemName="CompiledAssemblies" /> </MSBuild> </Target> In order to implement proper Clean/Clobber logic, I would like to retrieve the list of files that would be compiled if a build were performed with the current options.

MSBuild - ItemGroup of all bin directories within subdirectories

♀尐吖头ヾ 提交于 2019-12-01 05:32:36
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 it doesn't contain anything: <ItemGroup> <BinDirs Include="**\bin" /> </ItemGroup> I'm not sure why this doesn't work. Can anyone point me in the right direction to achieve what I'm trying to do? Regards, Nick peridian Since this hasn't got an answer, yet comes high on the list of Google results: The link provided by Alexey has several answers to

How to retrieve @(TargetOutputs) without performing a build

限于喜欢 提交于 2019-12-01 05:28:38
I'm implementing an MSBuild framework to drive the building and deployment of many projects organized as a hierarchy. <Target Name="_CoreBuild"> <MSBuild Projects="@(Project)" Targets="Build" Properties="Configuration=$(Configuration)"> <Output TaskParameter="TargetOutputs" ItemName="CompiledAssemblies" /> </MSBuild> </Target> In order to implement proper Clean/Clobber logic, I would like to retrieve the list of files that would be compiled if a build were performed with the current options. <Target Name="_CoreClobber" DependsOnTargets="_CoreClean"> <!-- How to retrieve @(CompiledAssemblies)

MSBuild - ItemGroup of all bin directories within subdirectories

陌路散爱 提交于 2019-12-01 04:06:45
问题 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 it doesn't contain anything: <ItemGroup> <BinDirs Include="**\bin" /> </ItemGroup> I'm not sure why this doesn't work. Can anyone point me in the right direction to achieve what I'm trying to do? Regards, Nick 回答1: Since this hasn't got an answer,

Cross-Join ItemGroups in MSBuild

帅比萌擦擦* 提交于 2019-11-29 07:40:08
Given something like so.. <?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="test" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> <ConfigFiles Include="*.config" /> <DatabaseConfig Include="ABC"> <Database>DB1</Database> <CsString>Database</CsString> </DatabaseConfig> <DatabaseConfig Include="DEF"> <Database>DB2</Database> <CsString>Logging</CsString> </DatabaseConfig> </ItemGroup> <Target Name="test" > <!-- Some sort of join here (or somewhere)... --> <Message Text=" %(Combined.ConfigFile) %(Combined.Database) " /> </Target> </Project> I'd like the