Questions tagged [msbuild-task]

MSBuild tasks give the MSBuild platform the ability to execute any number of actions during the build process. A task is a unit of executable code used by MSBuild to perform atomic build operations.

MSBuild tasks give the MSBuild platform the ability to execute any number of actions during the build process. A task is a unit of executable code used by MSBuild to perform atomic build operations.

741 questions
13
votes
4 answers

date format in msbuild script?

In my msbuild script I'm creating a zip file with year/month/day in the zip filename, but month and day are always written with no leading zero. Is there a way to add leading zero to my zip filename?
12
votes
3 answers

Passing array to custom MSBuild task

I thought this would be quite simple but then realised that I couldnt find any information on it anywhere. I have a custom task like so: public class MyCustomTask : Task { [Required] public string[] SomeStrings {get;set;} public…
Grofit
  • 17,693
  • 24
  • 96
  • 176
12
votes
1 answer

MSBuild Condition IsDebug

How can I determine if a project is build in Debug (or Release) mode within an MSBuild .targets file and use this information as a condition for another property? Something like:
Thanasis Ioannidis
  • 2,981
  • 1
  • 30
  • 50
12
votes
2 answers

Change only Revision number in AssemblyInfo.cs with MSBuild FileUpdate task

I need to change only the revision number of an AssemblyInfo.cs file. The version number is in the format Major.Minor.Build.Revision e.g. 1.4.6.0. Currently I change the version with the FileUpdate task (from the MSBuild Community Tasks Project) and…
Divya mohan Singh
  • 485
  • 2
  • 7
  • 18
12
votes
2 answers

make an MSBuild Copy Task only copy if the source is newer regardless of size

I'm currently using an msbuild file to copy some files to the public documents folder when my EXE is compiled. My current script includes this:
Brannon
  • 5,324
  • 4
  • 35
  • 83
12
votes
1 answer

How concatenate files in MSBuild and preserve tabs and spaces

I'm trying to concatenate a few files during my build but the way I tried strips out the tabs and spaces leaving the output unformatted.
parliament
  • 21,544
  • 38
  • 148
  • 238
11
votes
2 answers

MSBuild custom task "Hello World" walkthrough

Can someone write (or link to) a walkthrough that explains exactly how to create a custom MSBuild task and run it during a build? I'm looking for a custom task that inherits from Microsoft.Build.Utilities.Task and does only this: public override…
Ryan Lundy
  • 204,559
  • 37
  • 180
  • 211
10
votes
2 answers

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

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…
Andrew Van Slaars
  • 1,816
  • 1
  • 14
  • 20
10
votes
2 answers

Verbosity of MSBuild Copy Command

In an MSBuild task, you can set the overall verbosity, but what I'd really like to do is set the Verbosity of just the 'Copy' command. It prints out a line for every file it's copying in the "normal" verbosity setting, which in my case is thousands…
Tom Lianza
  • 4,012
  • 4
  • 41
  • 50
9
votes
2 answers

How do you write an MSBuild task to support cancelation?

I have a custom MSBuild task for xUnit.net. When the task is running, if I hit Ctrl+C, it 'tries' to cancel the task, but of course it fails (since my task doesn't support cancelation). No amount of MSDN doc searchs or Google-fu have landed on a…
Brad Wilson
  • 67,914
  • 9
  • 74
  • 83
9
votes
1 answer

ASP.NET Core & SPA - client files not published when the client is outside of the server folder

I have a project which has separate client and server folders and my goal is to include client files during the server's publish process. The folder structure looks like this |- server | |- src | |- MyProject | |- MyProject.csproj |-…
pikausp
  • 1,142
  • 11
  • 31
9
votes
1 answer

XmlPoke task trims value

Is there a way to use value ending with space as XmlPoke value? When I execute task, value is replaced but without space at the end. Reproduction: test.targets:
Filip
  • 3,257
  • 2
  • 22
  • 38
9
votes
2 answers

Enabling Code Analysis for .Net Core 2.0 project results CA0055 and CA0052 errors

Currently I'm getting CA0055 and CA0052 code analysis errors (both with Visual Studio 2017 and also by using MSBuild command) after configuring ASP.Net Core 2.0 application with custom code analysis ruleset which are defined for our projects. Tried…
9
votes
1 answer

MSBuild: Run target after solution builds from within Visual Studio

We have a solution with several projects in it, and need to run a tool on our compiled code after all of our code is compiled. The tool must take, as input, all .dll and .exe files built from the solution (so for an incremental build, it is not…
GalaxyInvader
  • 91
  • 1
  • 1
  • 3
9
votes
2 answers

How to access the MSBuild 's properties list when coding a custom task?

I need to write a custom task that print all the defined properties (the non-reserved ones). So in my C# code, I wanna access to the properties list of MSBuild engine and I don't know how. Please help.
Nam G VU
  • 33,193
  • 69
  • 233
  • 372
1 2
3
49 50