msbuild-task

MSBuild and Webpack

醉酒当歌 提交于 2019-11-28 21:35:45
问题 I am developing an Angular2 application in VS2015 and have a webpack bundling and minification environment set up for the same. This is my webpack.conf.js switch (process.env.NODE_ENV) { case 'prod': case 'production': module.exports = require('./config/webpack.prod'); break; case 'test': case 'testing': //module.exports = require('./config/webpack.test'); break; case 'dev': case 'development': default: module.exports = require('./config/webpack.dev'); } I have also installed a webpack task

MSBuild Task syntax for deleting files

*爱你&永不变心* 提交于 2019-11-28 16:56:03
问题 I'm trying to write a MSBuild Task that deletes the Obj directory and PDBs from my bin folder on my production build scripts and can't seem to get it to work right. Does anyone have an example where they do this or similar, or a link to a simple example of removing files and a directory with MSBuild? 回答1: If you're looking to delete an entire directory you require the RemoveDir task: <RemoveDir Directories="Path/To/Obj" /> And if you're wanting to delete the PDB files from bin you'll want the

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

杀马特。学长 韩版系。学妹 提交于 2019-11-28 16:30:46
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? The answer to this question can be found in the Microsoft.Common.targets file which can be found (depending on wether you're using the 64-bit or 32-bit framework) at: C:\Windows\Microsoft.NET\Framework64\v4.0.30319

How to pass TFS variable to a MSBuild task of the project [duplicate]

谁说胖子不能爱 提交于 2019-11-28 09:11:16
This question already has an answer here: How to get BuildNumber in .proj (MSBuild) using TFS server 1 answer I have a solution which is built on TFS server. This solution includes several projects which have custom MSBuild tasks. Theses tasks actually create some zip archives. I need to extract somehow the $(Rev) macros from the TFS build and pass it to the tasks. I tried to use MSBuildArguments in the process tab of the build definition and it works when I set a simple string value like: /p:Version="5" but it doesn't work with the macros: /p:Version="$(Rev:r)" do you have any ideas? Edit: I

MSBuild task configuration property

断了今生、忘了曾经 提交于 2019-11-28 09:02:56
I have three Visual Studio solutions. The first is configured to build as Release , and the other two are set to build as Debug . When running a simple MSBuild script explicitly stating the configuration to build (Debug), the first project is still built as Release. Sample script: <Target Name="Build"> <ItemGroup> <ProjectToBuild Include="$(SolutionsPath)\Solution1.sln"/> <ProjectToBuild Include="$(SolutionsPath)\Core\Solution2.sln"/> <ProjectToBuild Include="$(SolutionsPath)\UI\Solution3.sln"/> </ItemGroup> <MSBuild Projects="@(ProjectToBuild)" Targets="Rebuild" Properties="Configuration

Return output from an MsBuild task?

谁都会走 提交于 2019-11-28 08:55:14
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, ...? Julien Hoarau 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="CalculateAndUsePath"> <CalculatePathTask> <Output TaskParameter="Path" PropertyName=

MSBuild ReadLinesFromFile all text on one line

纵饮孤独 提交于 2019-11-28 07:39:05
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"> <ReadLinesFromFile File="@(MyTextFile)" > <Output TaskParameter="Lines" ItemName="ReleaseNoteItems"/> <

Passing multiple values to Wix DefineConstants property with MSBuild

狂风中的少年 提交于 2019-11-28 05:06:17
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 the DefineConstants key? I've tried all the 'logical' separators (space, comma, semi-colon, pipe-symbol

Visual Studio 2008 locks custom MSBuild Task assemblies

倾然丶 夕夏残阳落幕 提交于 2019-11-28 04:22:55
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, when project (2) builds, it locks onto the assembly from project (1). So now I can't build project (1)

Determining outputs of a ProjectReference in MSBuild without triggering redundant rebuilds

此生再无相见时 提交于 2019-11-28 03:48:13
问题 As part of a solution containing many projects, I have a project that references (via a <ProjectReference> three other projects in the solution, plus some others). In the AfterBuild , I need to copy the outputs of 3 specific dependent projects to another location. Via various SO answers, etc. the way I settled on to accomplish that was: <MSBuild Projects="@(ProjectReference)" Targets="Build" BuildInParallel="true" Condition="'%(Name)'=='ProjectA' OR '%(Name)'=='ProjectB' OR '%(Name)'==