msbuild-propertygroup

How to specify CodeAnalysisRules in MSBuild via commandline

眉间皱痕 提交于 2020-01-02 04:55:11
问题 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

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

走远了吗. 提交于 2020-01-02 03:39:13
问题 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:

MSBuild Property Scope

╄→尐↘猪︶ㄣ 提交于 2019-12-30 00:52:07
问题 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">

Using Microsoft.Build.Evaluation to publish a database project (.sqlproj)

末鹿安然 提交于 2019-12-17 18:28:46
问题 I need to be able to publish an SSDT project programmatically. I am looking at using Microsoft.Build to do so but can not find any documentation. It seems pretty simple to create the .dacpac, but how would I either publish to an existing database or at the very least to a .sql file. The idea is to have it do what it does when I right click on the project and select publish. It should compare with a selected database and generate an upgrade script. This is what I have so far to create the

how to replace string in file using msbuild?

*爱你&永不变心* 提交于 2019-12-17 09:35:54
问题 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 回答1: 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

MSBuild multiple outputpath

心已入冬 提交于 2019-12-12 14:23:02
问题 I saw this S.O question and have a similar requirement. This is what I have in a .targets file - <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup Condition="$(TeamBuildOutDir) != '' "> <OutputPath>$(TeamBuildOutDir)\Assemblies</OutputPath> </PropertyGroup> How can I output to multiple folders? e.g.- $(TeamBuildOutDir)\Assemblies2 TIA Thanks Nick, The copy/paste mucked it up. This is what I tried - <Project xmlns="http://schemas.microsoft.com/developer

Scope and order of evaluation of Items in MsBuild

孤人 提交于 2019-12-11 07:38:09
问题 I wonder why in the following code, MsBuild refuses to set the Suffix Metadata. It does work with a CreateItem task instead of the ItemGroup Declaration (because CreateItem is computed at build time) but I can't do this here because this code is in a "property file" : the project has no target, it's just a bunch of properties/items I include in real projects. <ItemGroup> <Layout Include="Bla"> <PartnerCode>bla</PartnerCode> </Layout> <Layout Include="Bli"> <PartnerCode>bli</PartnerCode> <

FTP Credentials for MSBuild.ExtensionPack.Communication.Ftp

余生长醉 提交于 2019-12-11 06:36:17
问题 In my AfterBuild script I use the following method to upload the files to the deployment server: <MSBuild.ExtensionPack.Communication.Ftp TaskAction="UploadFiles" Host="localhost" FileNames="$(SomeFolder)\$(FileToUpload)" UserName="myUserName" UserPassword="myPassword" RemoteDirectoryName="/" /> How can I load these credentials from a text file or an external source? What are the alternatives? I don't want to hard-code ftp credentials into my cproj files. I used GranadaCoders method to answer

MSbuild, How to access project property value in Inline Task code?

笑着哭i 提交于 2019-12-10 14:58:13
问题 I have inline Task code written in csharp I wonder if there is anyway to access propect property in inline Task code For ex. I am trying to replace string match with project property value. is it possible? <![CDATA[ MatchCollection matches = Regex.Matches(SourceStr, Pattern); for (int i = 0; i < matches.Count; i++) // replace the match value with project property... possible? ]]> 回答1: Pass it as a parameter, like you would with a compiled task? <ParameterGroup> <Foo ParameterType="System.Bar"

How to create a new property in MSBuild and reference it in WIX

╄→尐↘猪︶ㄣ 提交于 2019-12-10 14:37:01
问题 We need to create a property to indicate our software version. Then we want to use it inside our WIX project, i.e., reference it in wxs file. We don't want to define it in wxs file because we want the MSBuild to rename output file based on this version number too. A definition of constants in PropertyGroup is not a proper place for us and here is the reason: The properties defined in the PropertyGroup is Configuration/Platform specific. Whenever we modify this preprocessor in Visual Studio