msbuild

MSBuild - Getting the target called from command line

Does anyone know how to get the name of the TARGET (/t) called from the MSBuild command line? There are a few types of targets that can be called and I want to use that property in a notification to users. Example: msbuild Project.proj /t:ApplicationDeployment /p:Environment=DEV I want access to the target words ApplicationDeployment ...

MSBuild: How to obtain number of warnings raised?

There is a MSBuild script, that includes number if Delphi and C# projects, unit tests etc. The problem is: how to mark build failed if warnings were raised (for testing purposes, not for release builds)? Using LogError instead of LogWarning in custom tasks seems to be not a good option, because the build should test as much as it's abl...

Create MSBuild custom task to modify C# code *before* compile

I want to create a custom MSBuild task that changes my .cs files before they are compiled by csc.exe (but, of course, that doesn't modify them in place - I don't want actual source files touched). I am aware of PostSharp and other AOP frameworks for .NET and they are not an option for this particular project, plus I'd like to learn how ...

How do I get Team Build to run MbUnit tests?

I am having trouble getting Team Build to execute my MbUnit unit tests. I have tried to edit TFSBuild.proj and added the following parts: <Project ...> <UsingTask TaskName="MbUnit.MSBuild.Tasks.MbUnit" AssemblyFile="path_to_MbUnit.MSBuild.Tasks.dll" /> ... ... <ItemGroup> <TestAssemblies Include="$(OutDir)\Project1.dll" /> ...

VB6 Integration with MSBuild

Hi Everyone, So this is a question for anyone who has had to integrate the building/compilation of legacy projects/code in a Team Build/MSBuild environment - specifically, Visual Basic 6 applications/projects. Outside of writing a custom build Task (which I am not against) does anyone have any suggestions on how best to integrate comp...

How do I write output to the console from a custom MSBuild task?

I'm trying to debug an MSBuild task, and I know there is some way to write to the MSBuild log from within a custom task but I forget how. ...

msbuild: set a specific preprocessor #define in the command line

In a C++ file, I have a code like this: #if ACTIVATE # pragma message( "Activated" ) #else # pragma message( "Not Activated") #endif I want to set this ACTIVE define to 1 with the msbuild command line. It tried this but it doesn't work: msbuild /p:DefineConstants="ACTIVATE=1" Any idea? ...

Seeing project dependancies from MSBuild

Is there a mode, some switch or a programmatic way that I can ask MSBuild to display or output it's calculated dependencies for a given build file? Some background - I have a large project that requires splitting up to speed up the build time and want to remove the slow changing infrastructure code into it's own release area. Not all ...

Example of using Service Exists MSBuild task in Microsoft.Sdc.Tasks?

I'm trying to use the Microsoft.Sdc.Tasks.ServiceProcess.Exists to check whether or not a service exists. There is no example of using it in the documentation though. Anyone have one? ...

Using Microsoft.Sdc.Tasks.ServiceProcess.ControlService how do I check if a service exists on a remote machine?

I'm trying to check if a service exists on a remote machine using the Microsoft.Sdc.Tasks.ServiceProcess.ControlService task. <ControlService MachineName="$(TargetMachineName)" Action="Exists" ServiceName="w3svc"> <Output PropertyName="W3ServiceExists" TaskParameter="ServiceExists" /> </ControlService> When I use the above task d...

Automatic Update and checkin of AssemblyInfo.cs files occasionally causes partial fail

We have TFS 2008 our build set up to checkout all AssemblyInfo.cs files in the project, update them with AssemblyInfoTask, and then either undo the checkout or checkin depending on whether the build passed or not. Unfortunately, when two builds are queued close together this results in a Partially completed build as the AssemblyInfo.cs ...

How can I get MSBUILD to evaluate and print the full path when given a relative path?

How can I get MSBuild to evaluate and print in a <Message /> task an absolute path given a relative path? Property Group <Source_Dir>..\..\..\Public\Server\</Source_Dir> <Program_Dir>c:\Program Files (x86)\Program\</Program_Dir> Task <Message Importance="low" Text="Copying '$(Source_Dir.FullPath)' to '$(Program_Dir)'" /> Output ...

Is there an MSBuild task that will extract the path give from a file name?

I use the following to get a list of project files that need to be compiled. Each project is stored in a subdirectory of the projects directory. <ItemGroup> <dprs Include="c:\projects\**\*.dpr" /> </ItemGroup> Is there a task that I can use to extract to extract the directory that each project file is in? I know I can write my...

MSBUILD Task Items in subdirectories: Are incremental builds not possible on these?

I have a simple Word to Pdf converter as an MSBuild Task. The task takes Word files (ITaskItems) as input and Pdf files (ITaskItems) as output. The script uses a Target transform for conversion: <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> <UsingTask AssemblyFile="$(MS...

Using MSBuild to filter out unwanted extensions and folders

Hi, Using MSBuild, how can I filter out unwanted extensions in my project (and folders potentially)? Extensions like .cs, .resx files etc. ...

Automatically increment "minimum required version" in a ClickOnce deployment?

Is there a way to automatically increment the "minimum required version" fields in a ClickOnce deployment to always equal the current build number? Basically, I always want my deployment to be automatically updated at launch. I suspect I'm going to need a some pre-/post-build events, but I hope there's an easier way. ...

How do you auto-deploy a website during a release build?

I'd like to upload (via ftp) a website when doing a release build in visual studio 2008. I don't want any source code files to be uploaded and it would be nice to configure which folders should get uploaded. I'm using either ASP.NET Web Applications or MVC. How do I configure VS.NET to automatically upload (and overwrite) the last dep...

Having trouble getting MSBuild and MSBuildCommunityTasks (VSS) to work together

I am trying to learn how to do certain source control tasks with VSS and MSBuildCommunityTasks, like how to use tasks like GetVSS and VssLabel? Docs don't make this clear. And when I poke a stick at it to see if the error messages can tell me anything, it isn't really very clear what to do then, either. Let me show what I'm doing and ...

MSBuild -- Use the .csproj file or roll your own?

OK, so I readily concede that I'm a newbie when it comes to continuous integration. That being said, I'm trying to set up a CC.NET environment to educate myself, but I'm having trouble finding the information I need to get the automated build portion set up. As I understand it, in C# the .csproj file produced by VS 2005 and forward is ...

Programatically find TFS changes since last good build

I have several branches in TFS (dev, test, stage) and when I merge changes into the test branch I want the automated build and deploy script to find all the updated SQL files and deploy them to the test database. I thought I could do this by finding all the changesets associated with the build since the last good build, finding all the ...