msbuild-task

MSBuild copy output from another project into the output of the current project

主宰稳场 提交于 2019-11-28 01:06:37
问题 I have a situation where I want to copy the output assembly from one project into the output directory of my target application using MSBuild, without hard-coding paths in my MSBuild Copy task. Here's the scenario: Project A - Web Application Project Project B - Dal Interface Project Project C - Dal Implementation Project There is a Business layer too, but has no relevance for the MSBuild problem I'm looking to solve. My business layer has a reference to my Dal.Interface project. My web

MSBuild targets and Visual Studio 2012 issues

二次信任 提交于 2019-11-28 00:36:55
问题 I'm having a hard time getting my third party non-reference assemblies deployed via Webdeploy withing the Visual Studio 2012 UI. I have a folder called 'libraries', which contains some assemblies. Via the following in my *.csproj file I can set the Build Action to ' ThirdPartyAssemblies ': <ItemGroup> <AvailableItemName Include="ThirdPartyAssemblies"> <Visible>false</Visible> </AvailableItemName> </ItemGroup> <Target Name="AfterBuild"> <Message Text="Build | Third party assemblies" Importance

What is the difference between a PreBuildEvent, BeforeBuild target and BeforeCompile target in MSBuild?

泪湿孤枕 提交于 2019-11-27 09:50:17
问题 I recently had to move some code from a PreBuildEvent in Visual Studio into the BeforeBuild target to make it work on AppHarbor. While doing so, I also noticed a BeforeCompile target. What is the difference between these three seemingly similar events: PreBuildEvent, BeforeBuild Target, BeforeCompileTarget? What can/can't be done with each, and why would you pick one over another? 回答1: The answer to this question can be found in the Microsoft.Common.targets file which can be found (depending

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

Return output from an MsBuild task?

南笙酒味 提交于 2019-11-27 02:31:17
问题 I'd like to calculate a path in a MsBuild task, to be used by another MsBuild task. What is the best way to accomplish this? Setting a environment variable, printing to Console, ...? 回答1: Use a property or an item. Your MSBuild that calculates the path, return it as a property and you use this property as input for your other task. public class CalculatePathTask : ITask { [Output] public String Path { get; set; } public bool Execute() { Path = CalculatePath(); return true; } } <Target Name=

Passing multiple values to Wix DefineConstants property with MSBuild

社会主义新天地 提交于 2019-11-27 00:47:44
问题 I'm currently integrating my Wix projects in MSBuild. It is necessary for me to pass multiple values to the Wix project. One value will work (ProductVersion in the sample below). <Target Name="BuildWixSetups"> <MSBuild Condition="'%(WixSetups.Identity)'!=''" Projects="%(WixSetups.Identity)" Targets="Rebuild" Properties="Configuration=Release;OutputPath=$(OutDir);DefineConstants=ProductVersion=%(WixSetups.ISVersion)" ContinueOnError="true"/> </Target> However, how do I pass multiple values to

Visual Studio 2008 locks custom MSBuild Task assemblies

吃可爱长大的小学妹 提交于 2019-11-27 00:28:07
问题 I'm developing a custom MSBuild task that builds an ORM layer, and using it in a project. I'm being hampered by Visual Studio's behaviour of holding onto MSBuild task DLLs and not letting go. I'd like to organize my solution like this; My Solution | +- (1) ORM Layer Custom Task Project | | | +- BuildOrmLayerTask.cs // here's my task | +- (2) Business Logic Project // and here's the project that uses it. | +- <UsingTask TaskName="BuildOrmLayerTask" AssemblyFile="$(TaskAssembly)" /> However,

MSBuild ReadLinesFromFile all text on one line

妖精的绣舞 提交于 2019-11-26 22:58:06
问题 When I do a ReadLinesFromFile on a file in MSBUILD and go to output that file again, I get all the text on one line. All the Carriage returns and LineFeeds are stripped out. <Project DefaultTargets = "Deploy" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" > <Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/> <ItemGroup> <MyTextFile Include="$(ReleaseNotesDir)$(NewBuildNumber).txt"/> </ItemGroup> <Target Name="ReadReleaseNotes">

Is a separate Visual Studio license required for a build machine?

孤街浪徒 提交于 2019-11-26 22:50:26
问题 I know that some companies allow you to install their products on build machines as required without requiring a separate license (DevExpress is one that comes to mind). However I was wondering if Microsoft had the same allowances on licenses. MSBuild does not support vdproj directly and require you to run Visual Studio from the command line to build the setup project. See here I need to produce a setup file via an automated build; do I need to purchase an additional license for the build

Using WriteCodeFragment MSBuild Task

旧城冷巷雨未停 提交于 2019-11-26 22:11:36
问题 I am trying to use WriteCodeFragment MSBuild task to create AssemblyVersion attribute. I'm having a a problem creating a property group to correctly pass the ITaskItem array required for processing. Can someone help with an example. 回答1: This creates a file called BuildVersion.cs with an AssemblyVersion attribute of 123.123.123.123 . If OutputFile is removed then a randomly generated file name will be used instead. The Compile item name automatically adds the item to the Compile items