msbuild-propertygroup

When you import another msbuild file, what is the order of evaluation?

旧街凉风 提交于 2019-12-06 19:12:26
问题 I have a shared properties file shared.properties.proj <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <SharedAssemblySearch>$(MSBuildProjectDirectory)\..\Shared Assemblies</SharedAssemblySearch> <ParentDir>..</ParentDir> <SharedAssemblySearch Condition="!Exists('$(SharedAssemblySearch)')">$(ParentDir)\$(SharedAssemblySearch)</SharedAssemblySearch> <SharedAssemblySearch Condition="!Exists('$(SharedAssemblySearch)')">$(ParentDir)\$(SharedAssemblySearch)<

Why is $([System.Text.RegularExpressions.Regex]::IsMatch()) evaluated once in ItemGroupDefinition?

强颜欢笑 提交于 2019-12-06 10:49:05
问题 So fiddling with MSBuild tasks, and I am finding that a Regex metadata property is evaluated once rather than per item. For example <!-- actual items, we use standard project reference items and extend via ItemDefinitionGroup. add project references through IDE to extend coverage --> <ItemGroup> <ProjectReference Include="..\Example.UnitTests-x86\Example.UnitTests-x86.csproj"> <Project>{7e854803-007c-4800-80f9-be908655229d}</Project> <Name>Example.UnitTests-x86</Name> </ProjectReference>

Passing property group value from one MsBuild task to another

痴心易碎 提交于 2019-12-05 14:44:30
问题 How do I keep values defined in one build target alive in other targert? If PropertyGroup is not the write MsBuild entity I should use here, what is? ReleaseDir is printed ok in "Package" target, but is empty in "DoPackage" <Target Name="Package"> <PropertyGroup> <ReleasesDir>c:\tmp</ReleasesDirBase> </PropertyGroup> <Message Text="$(ReleaseDir)"/> <CallTarget Targets="DoPackage" Condition="!Exists('$(ReleaseDir)')"/> </Target> <!-- Do the acutal packaging --> <Target Name="DoPackage">

How to specify CodeAnalysisRules in MSBuild via commandline

落爺英雄遲暮 提交于 2019-12-05 10:15:45
I want to be able to specify the Code AnalysisRules in commandline MSBuild (for Code Analysis / FXCOP). The project file would have something like this in it: <CodeAnalysisRules>-Microsoft.Globalization#CA1301;-Microsoft.Globalization#CA1302</CodeAnalysisRules> So I would assume that I use something like this: MSBuild.exe /property:RunCodeAnalysis=true /property:CodeAnalysisRules=-Microsoft.Globalization#CA1301 Which works fine, but when I want to add another rule, it does not like the semi colon: MSBuild.exe /property:RunCodeAnalysis=true /property:CodeAnalysisRules=-Microsoft.Globalization

Find out the “Bit”ness of the current OS in MSBuild

空扰寡人 提交于 2019-12-05 07:01:19
I have a build script that needs to hard code a path to an executable. The path is: C:\Program Files\Microsoft Visual Studio 9.0\SmartDevices\SDK\SDKTools\cabwiz.exe This has worked fine, but now I am running on a 64 bit OS (but my coworker and build server are on 32 bit still). I need the path to be this for me: C:\Program Files (x86) \Microsoft Visual Studio 9.0\SmartDevices\SDK\SDKTools\cabwiz.exe But use the normal path for the others. Here is how I set it up: <PropertyGroup> <CabWiz>"C:\Program Files\Microsoft Visual Studio 9.0\SmartDevices\SDK\SDKTools\cabwiz.exe"</CabWiz> <

When you import another msbuild file, what is the order of evaluation?

假装没事ソ 提交于 2019-12-05 00:31:25
I have a shared properties file shared.properties.proj <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <SharedAssemblySearch>$(MSBuildProjectDirectory)\..\Shared Assemblies</SharedAssemblySearch> <ParentDir>..</ParentDir> <SharedAssemblySearch Condition="!Exists('$(SharedAssemblySearch)')">$(ParentDir)\$(SharedAssemblySearch)</SharedAssemblySearch> <SharedAssemblySearch Condition="!Exists('$(SharedAssemblySearch)')">$(ParentDir)\$(SharedAssemblySearch)</SharedAssemblySearch> <SharedAssemblySearch Condition="!Exists('$(SharedAssemblySearch)')">$(ParentDir)\

Why is $([System.Text.RegularExpressions.Regex]::IsMatch()) evaluated once in ItemGroupDefinition?

久未见 提交于 2019-12-04 19:22:41
So fiddling with MSBuild tasks, and I am finding that a Regex metadata property is evaluated once rather than per item. For example <!-- actual items, we use standard project reference items and extend via ItemDefinitionGroup. add project references through IDE to extend coverage --> <ItemGroup> <ProjectReference Include="..\Example.UnitTests-x86\Example.UnitTests-x86.csproj"> <Project>{7e854803-007c-4800-80f9-be908655229d}</Project> <Name>Example.UnitTests-x86</Name> </ProjectReference> <ProjectReference Include="..\Example.UnitTests\Example.UnitTests.csproj"> <Project>{eaac5f22-bfb8-4df7

Msbuild copy to several locations based on list of destination parameter?

倾然丶 夕夏残阳落幕 提交于 2019-12-04 01:11:49
问题 I got a directory I want to copy to a number of locations. Say I have home.aspx I want to copy it to abc/home.aspx def/home.aspx ghi/home.aspx so two questions for me: How do I define the list abc, def, ghi? How do I execute my Copy task with each element of this list? 回答1: Here is an actual example that I put together that shows what you were looking for: <?xml version="1.0" encoding="utf-8"?> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Test"

MSBuild Property Scope

≯℡__Kan透↙ 提交于 2019-11-30 04:45:44
Once again I'm battling MSBuild. I want to have a property value defined with a root path. As part of the build, the path will get updated with version information. However, MSBuild seems to have its own scoping rules that seem completely backwards. Take this first example: <?xml version="1.0" encoding="utf-8"?> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> <PropertyGroup> <MyPath>\\server\folder</MyPath> </PropertyGroup> <Target Name="Main"> <Message Text="In Main Before - MyPath = $(MyPath)"/> <CallTarget Targets="Task1" /> <CallTarget Targets=

how to replace string in file using msbuild?

江枫思渺然 提交于 2019-11-27 08:14:58
I want to replace a string such "how r u" in file test.xml with a string "i am fine" in another file xy.xml.using regular expression in ms build. ie i have to read string from one file(xy.xml) and replace it in another file test.xml. so please provide necessary steps to solve this issue with example EDIT: This answer is obsolete. Use solution below... Use ReadLinesFromFile task to get replacement string from the xy.xml file. Check this Then use value from xy.xml as a replacement string for FileUpdate task. Check this And put it all together ;) This is no longer required... you can now inject C