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-task
Filter by
Sorted by
Tagged with
2 votes
0 answers
3k views

ASP.NET 4 web.config transformation MSBUILD

I want to use the newly introduced web.config transformation options in VS2010. But I'm not using the Deploy option of VS2010, i'm using Web Deployment Projects with MSBUILD tasks. Can I apply the ...
joop's user avatar
  • 21
7 votes
3 answers
3k views

MSBuild: How do I create and use a Task to convert Content items at build time?

I have a Silverlight 3 project with something like this: <ItemGroup> <Content Include="Content\image1.png"> </Content> </ItemGroup> Basically I've added a PNG file to my ...
Andrew Russell's user avatar
1 vote
1 answer
192 views

MSBuild task to get update FileAssemblyVersion for only projects with changes

Is there any way, using msbuild or otherwise, to detect which projects have changes in the current build and update the FileAssemblyVersion attribute in AssemblyInfo.cs for those projects only?
Jonathan McPhail's user avatar
28 votes
3 answers
3k views

Visual Studio 2008 locks custom MSBuild Task assemblies

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 ...
Steve Cooper's user avatar
  • 21.2k
4 votes
2 answers
5k views

Wrong version of aspnetcompiler when using msbuild 4.0

I'm trying to use the AspNetCompiler task within a custom msbuild file to precompile an asp .net 4.0 website. However, when i run: C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe custom....
smoak's user avatar
  • 14.8k
1 vote
2 answers
301 views

Test driven development of an MSBuild Task

What approach would you take while developing a custom MSBuild Task in a test driven way? Are there any available test harnesses suitable for test drive development of a Microsoft.Build.Utilities....
56 votes
3 answers
31k views

Is there any MSbuild task to check if a string contains another string (similar to string.contains)

I have this Msbuild code: <Import Project="A.proj" Condition="$(BuildDefinition) =='Dist Staging to Dev' Or $(BuildDefinition) =='Dist Staging to Dev(Services Only)'"/> But I was wondering if ...
Oscar Foley's user avatar
  • 6,907
0 votes
2 answers
322 views

When creating a custom Task how to get access to the MSBuild verbosity?

In the context of creating a custom Microsoft.Build.Utilities.Task how do I get access to the MSBuild verbosity? Microsoft.Build.Utilities.Task: http://msdn.microsoft.com/en-us/library/microsoft.build....
Simon's user avatar
  • 34.2k
3 votes
1 answer
5k views

MSBuild, custom task to run custom tool to generate classes for linq to sql model?

I have the following scenario. We use stored procedures to access the database and we use LiNQ 2 SQL to generate the classes or namely we use Unplugged LINQ to SQL Generator for this. It has been run ...
mhenrixon's user avatar
  • 6,239
0 votes
2 answers
520 views

msbuild task error while loading Microsoft.VisualStudio.Coverage.Analysis

I've written a custom task for analyzing code coverage results. While building the entire solution, I get the following error. error MSB4018: System.IO.FileNotFoundException: Could not load file or ...
Sidd's user avatar
  • 83
3 votes
2 answers
2k views

How can I add an MSBuild Import with IVsBuildPropertyStorage?

I'm trying to add an Import task to a .csproj file programmatically, but I don't want to use the Microsoft.Build.BuildEngine objects to do this because VS will then pop up warnings about the project ...
Greg's user avatar
  • 10.6k
2 votes
2 answers
187 views

F# and MSBuild Tool (silverlight)

We are trying to use Static Resources within a 100% F# Silverlight application. Embeded within the XAML of the referencing control, everything works. But once I pull them out I am a loss. C# ...
akaphenom's user avatar
  • 6,828
1 vote
1 answer
460 views

How using MSBuild Copy task? and Making target as lowercase filename?

How do I use the MSBuild Copy task? Also, it is seems to be making target as lowercase in the filename - is this right? <Copy SourceFiles="@(DATA)" DestinationFiles="@(DATA->'$(...
timesking's user avatar
  • 275
2 votes
2 answers
421 views

Why isn't @(DocFileItem) found during MSBuild AfterBuild task?

I'm trying to post-process the documentation XML file as a post-build XSLT transformation (using the new XSLTransformation step), but the build fails with error Unable to execute transformation. Could ...
Remus Rusanu's user avatar
0 votes
1 answer
367 views

How to create an sql script file in TFS 2008 at designated directory automatically for developers to add sql script?

I have just revised my question. Actually i wan to create an empty txt/.sql file in TFS 2008 Source Control server at designated directory/folder where developers can add sql script for their part of ...
Steve Johnson's user avatar
0 votes
1 answer
632 views

MSBuild get %(RecursiveDir) directive from custom task parameter

I'm developing a custom MSBuild task by inheriting from the base Task class. My task calls the Copy task declared in Microsoft.Build.Tasks.dll setting the DestinationFolder property in the process. My ...
Matthew Dresser's user avatar
3 votes
3 answers
1k views

When implementing a microsoft.build.utilities.task how to i get access to the various environmental variables of the build?

When implementing a microsoft.build.utilities.task how to i get access to the various environmental variables of the build? For example "TargetPath" I know i can pass it in as part of the task XML ...
Simon's user avatar
  • 34.2k
1 vote
0 answers
133 views

Using GenerateBootstrapper class in c# code to generate bootstrappers programmatically

Is there any way I can use GenerateBootstrapper class in c# code to generate bootstrappers programmatically? Has anyone tried this before?
deerchao's user avatar
  • 10.5k
5 votes
2 answers
4k views

MSBuild Build Sequence

Looking at this article from MS, I have a question about the SolutionToBuild section. <ItemGroup> <SolutionToBuild Include="$(SolutionRoot)\path\MySolution.sln /> <...
Paul Michaels's user avatar
4 votes
2 answers
2k views

Trouble with outputting MSBuild variables

I'm trying to output the variable from one target, into the parent target which started it. For example, Target 1 simply calls the task in file 2 and is supposed to be able to use the variable set ...
Chris Dobinson's user avatar
18 votes
3 answers
17k views

MSBuild 2010 - how to publish web app to a specific location (nant)?

I'm trying to get MSBuild 2010 to publish a web app to a specific location. I can get it to publish the deployment package to a particular path, but the deployment package then adds its own path that ...
Mr. Flibble's user avatar
  • 26.8k
4 votes
2 answers
736 views

How do i execute an MSBuild Task in VS2010 Web Deployment Build Template?

We've recently upgraded from VS2008 -> VS2010 (and hence upgrading from Web Deployment Project to proper deployment project). Obviously what's new in VS2010 web deployments is the introduction of ...
RPM1984's user avatar
  • 72.6k
6 votes
4 answers
21k views

Overriding MSBuildExtensionsPath in the MSBuild task is flaky

This is already cross-posted at MS Connect: https://connect.microsoft.com/VisualStudio/feedback/details/560451 I am attempting to override the property $(MSBuildExtensionsPath) when building a ...
Stuart Lange's user avatar
  • 4,079
0 votes
1 answer
403 views

NullReferenceException at Microsoft.Silverlight.Build.Tasks.CompileXaml.LoadAssemblies(ITaskItem[] ReferenceAssemblies)

I updated my Visual Studio 2010 to the version 10.0.30319.1 RTM Rel and start getting the following exception during the build: System.NullReferenceException: Object reference not set to an instance ...
Eugene Larchick's user avatar
9 votes
2 answers
4k views

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's user avatar
  • 34.2k
6 votes
2 answers
3k views

Using MSBuild, how to construct a dynamic string from iterating over files in an ItemGroup?

I need to create multiple /testcontainer: parameters to feed into a task that exec's MsTest. I have the following : <ItemGroup> <TestFiles Include="$(ProjectPath)\**\UnitTest.*.dll" /&...
RyBolt's user avatar
  • 1,764
1 vote
1 answer
2k views

GenerateBootstrapper fails to create a working setup.exe

I’m seeing some odd behaviour I can’t explain. I'm using wix to generate a msi and using the msbuild GenerateBootstrapper task to handle pre-requisites. It all seems to build correctly i.e. there ...
Darren's user avatar
  • 961
0 votes
1 answer
2k views

Get an error when trying to set the build version with the AssemblyInfo Task

I've added the AssemblyInfo Task reference to my C# project file (VS2008 .NET 3.5), but when I build I get the following error The "AssemblyInfo" task failed unexpectedly. System....
Glenn Slaven's user avatar
  • 33.9k
8 votes
3 answers
611 views

MSBuild Starter Kits

Just wondering if anyone knows if there are any MSBuild starter kits out there. What I mean by starter kits is that from the looks of it most builds to kinda the same sort of steps with minor ...
vdh_ant's user avatar
  • 12.9k
1 vote
3 answers
3k views

How to get the last part of $(MSBuildProjectDirectory)

I can't figure out how to get the last part of $(MSBuildProjectDirectory). For example, if the value was "c:\development\projects\project_branch" then I want just the last part "project_branch". How ...
Sean's user avatar
  • 11
1 vote
1 answer
343 views

install a service on a remote computer from a MSBuild script

I have this task that creates a service: Target Name="InstallService" DependsOnTargets="CopyFiles" Exec Command="sc \ \remotecomputer create "ServiceHost" binPath= "E:\ServiceHost.exe&...
Raul's user avatar
  • 295
1 vote
1 answer
1k views

How to get MSBuild Exec to run a java program?

I am trying to run a command line action in my Team Build (MSBuild). When I run it on the command line of the build machine it works fine. But when run in the build script I get a "exited with code ...
Vaccano's user avatar
  • 80.3k
9 votes
3 answers
7k views

How to get import custom tasks more than once without warning message?

I'm using some custom tasks from MSBuild Extension Pack (MEP). My projects are splitted among many files. In those files I import the MEP tasks using (twice or three times in two/three files). I ...
Nam G VU's user avatar
  • 34.2k
1 vote
2 answers
313 views

MSBuild's XmlMassUpdate task in NAnt?

I have created an MSBuild tasks for building my projects, but for various reasons I wan't to switch to NAnt. Is there some task that would be equivalent to MSBuild's XmlMassUpdate in NAnt? If ...
veljkoz's user avatar
  • 8,474
1 vote
1 answer
609 views

Read attributes of MSBuild custom tasks via events in the Logger

I am trying to write a MSBuild logger module which logs information when receiving TaskStarted events about the Task and its parameters. The build is run with the command: MSBuild.exe /logger:...
g t's user avatar
  • 7,337
5 votes
2 answers
1k views

msbuild custom task

I have a custom MSBuild task that takes in a set of JavaScript files, minifies them, and outputs them, with the extension .min.js. When I do a normal build through Visual Studio, it works perfectly ...
Shane's user avatar
  • 211
6 votes
5 answers
5k views

Use XSD Build task in c# project

How can I use the c++ XSD Task in a c# project? I have already created the task in the csproj file like this: <Target Name="BeforeBuild"> <XSD Namespace="$(RootNamespace).Xml" Language=...
m0sa's user avatar
  • 10.8k
0 votes
1 answer
126 views

How to bind a target within MSBuild to a general error

We are using TFS build and we have a couple of custom steps within the configuration (e.g. running NUnit tests in AfterCompile target, deployment steps in AfterDropBuild target etc.). Now I wanted to ...
Tomas Vana's user avatar
  • 18.5k
7 votes
4 answers
13k views

Determining outputs of a ProjectReference in MSBuild without triggering redundant rebuilds

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 ...
Ruben Bartelink's user avatar
3 votes
2 answers
1k views

How do I determine the current operating system version in MSBuild?

Is there a native or custom MSBuild task available that returns the current OS version? Is there a binary that I could call via an Exec task? Or is there some other option? Edit: Peter Lang ...
Scott Lawrence's user avatar
5 votes
2 answers
6k views

Use MSBuild to build Entity Framework Model without using the Project File?

I am in the process of build a script for a fairly big project. One of the projects require an Entity Framework Model to be compiled into a library. Due to the way the build server works, all builds ...
BinaryMisfit's user avatar
  • 29.8k
0 votes
2 answers
568 views

Cruise Control.net Ms Build Task setting XML output Name

We are running version 1.5.6755.1 of CruiseControl.net. Here is our block that executes a build <!-- MSBuild of Source Code --> <cb:define name="BuildOneProject-block"> <...
Eric Brown - Cal's user avatar
13 votes
4 answers
8k views

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? ...
Goran's user avatar
  • 1,827
2 votes
1 answer
880 views

MsBuild - Is it possible to isolate batch tasks, so one failing task doesn't skip the remaining tasks?

Let me start by example... I have an all.proj that looks similar to this: <ItemGroup> <ProjectsToBuild Include="..\Sites\*\*.csproj" /> </ItemGroup> <Target Name="...
JohannesH's user avatar
  • 6,460
4 votes
2 answers
1k views

MSBuild ITaskItem RecursiveDir metadata disappears

I have a custom MSBuild task, which processes a set of files and returns a modified subset of this. Basically, I just create a new ITaskItem array out of the input, skipping some items. However, the ...
Sander's user avatar
  • 26k
2 votes
3 answers
1k views

Reading/Capturing DOS input for use in MsBuild

How do I capture/read DOS input for use in MsBuild? EDITED for clarification Currently I have 2 files. One batch file, the other is the core.msbuild file which contains the msbuild stuff. I want ...
BeraCim's user avatar
  • 2,317
3 votes
1 answer
2k views

Declaring dynamic profile path in MsBuild

Currently I'm trying to copy a file to a location inside a user's profile, but hit a problem with declaring dynamic profile name, e.g.: <Target Name="CopyScript"> <MsBuild Projects="...
BeraCim's user avatar
  • 2,317
1 vote
3 answers
3k views

MSBuild CopyTask: Copying the same file to multiple locations

Is there a way to get the CopyTask to copy the same file to multiple locations? eg. I've generated an AssemblyInfo.cs file and want to copy it across to all my projects before building.
Veli Gebrev's user avatar
  • 2,491
12 votes
2 answers
9k views

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 ...
Divya mohan Singh's user avatar
0 votes
1 answer
485 views

Encoding of copied file in MsBuild

I currently have a set of files which will get copied during build using MsBuild's copy task. The files were initially set to ANSI format. However the copied files turned into UTF-8 format. This ...
BeraCim's user avatar
  • 2,317