msbuild

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:MyLogger.dll build.xml Within the build.xml is a sequence of tasks, most of which have been custom written to compile a (C++ or C#) solution, a...

VS 2008 -- Using Relative paths in Build Properties

Hey all, Long story short, I have a test project file (C# project) that contains the NUnit assemblies. When I hit F5, the build properties tell the project to launch NUnit and run the appropriate tests. However, I work with a team and this project (including the NUnit binaries) are in subversion. Which means that when my partner pulls ...

Error: Cannot find .net assembly during FxCop analysis

I'm running FxCop from MSBuild and during the analysis it throws an error stating that it could not find the System.XML assembly and that I need to specify the location using the /directory parameter, which I then did but it didn't work. Any idea what I should do? I am running it on projects built on .Net 4.0 ...

WixSharp IIS Examples

Hi All, I am trying to find examples of how to use WIxSharp (managed code interface to Wix) to install a website and associate AppPool. The steps I want to achieve are: 1. If the website exists in IIS 6, delete it. 2. If the AppPool exists in IIS 6, delete it. 3. Delete the application artifacts from the destination directory. 4. Copy ...

Make a target run once at the Solution level in MSBuild

I need a set of tasks that need to be executed exactly once for the entire solution. This will run tasks that will modify each project to run a separate set of tasks for each project. We had done this earlier using a separate project to the solution which had the solution level tasks, but we want to move away from that. Has anyone done t...

Logs overwritten in CruiseCControl.NET when there is multiple MSBuild Tasks.

I have two MSBuild tasks in my CC.NET config. In the end of the execution, i can see two blocks of warnings/errors in the log and published email. But the problem is that the contents of both the blocks are the same and that is from the second MSBuild task!! In another way, the second MSBuild task overwrites the first log, and then creat...

Is there a way to print a new-line when using <Message...> ?

I wanna write <Message Text="Line1\nLine2\nLine3" /> but \n seems not to be working. What should I replace \n with? (I read in the books they said that to print @ and % we use %40 and %25, so I guess the should be a number for the new-line). ...

Microsoft.Build.Engine Error (default targets): Target GetFrameworkPaths: Could not locate the .NET Framework SDK.

I am writing a webservice, that when called should build a C# project. I'm using the framework 2 reference, Microsoft.Buld.Engine and Microsoft.Build.Framework. If you look under the '<Import>' section .csproj file, by default it has: <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> which I then changed to: <Import P...

How to overwrite ItemGroup (like what we do with PropertyGroup)

I have a script snippet looks like below: <ItemGroup> <files Include="*.txt"></files> </ItemGroup> <Message Text="@(files)"> <ItemGroup> <files Include="*.xml"></files> </ItemGroup> <Message Text="@(files)"> I want that in the second Message output, only *.xml is printed. Currently both of *.txt and *.xml are printed which is wha...

MsBuild WriteLinesToFile Task on multiple files

I have the following in a AfterGet target in TFS. <ItemGroup> <AssemblyInfoFiles Include="$(SolutionRoot)\**\*assemblyinfo.cs" /> </ItemGroup> <WriteLinesToFile File="@(AssemblyInfoFiles)" Lines="AssemblyInformationalVersion(&quot;$(LabelName)&quot;)]" Overwrite="false"/> The ItemGroup includes multiple files...

msbuild slower than devenv

Hi, I'm experiencing performance inconsistencies with regards to build duration when building a VS2008 solution file with either devenv or msbuild from command line. My solution contains both C# and C++ projects, and I have these results: devenv.exe (either command line or within the ide): 7 minutes msbuild.exe: 14 minutes I tried tun...

Visual Studio project build as an executable AND a DLL

In Visual Studio 2008 project properties, Application tab, I can set the Output type to Windows Application, Console Application, or Class Library. I have a project that I want to build as a stand-alone tool (console app) and be available to a couple other tools I'm working on as a class library. The VS GUI only lets me choose one or th...

Generate Visual Studio Project Templates with CruiseControl.Net or MSBuild

Hey all. I have a working workflow in CruiseControl.Net that successfully builds and tests an MSBuild project that is calling my Visual Studio 2010 solution. How do I create Visual Studio project templates in either CruiseControl.Net or with MSBuild? The build server does not have Visual Studio 2010 installed. Thanks for your time! N...

Debugging tools for msbuild build project

Do they exist or I need to read billions of lines of /verbosity:diag parameter lines? Maybe you have other solutions? ...

How do you update an environment variable from inside an Exec task?

I am trying to pipe the output from a command to an Environment variable thus: <Exec Command="for /f &quot;tokens=*&quot; %%i in ('svn info') do SET SVNINFO=%%i" /> and then use SVNINFO as a property in MSBuild. While the command line counterpart: for /f "tokens=*" %i in ('svn info') do SET SVNINFO=%i works, the change in the value...

Replace .sln with MSBuild and wrap contained projects into targets

I'd like to create a MSBuild project that reflects the project dependencies in a solution and wraps the VS projects inside reusable targets. The problem I like solve doing this is to svn-export, build and deploy a specific assembly (and its dependencies) in an BizTalk application. My question is: How can I make the targets for svn-expo...

Difference in DLL when compiling on Build Server instead of Dev Machine.

I have an application that loads user controls into .NET web application. When I compile and test the application locally on my dev machine it works on my machine. The project builds successfully using MSBuild on our build server. However when I deploy the dll generated by MSBuild on the build server I get the following error when the...

[MSBuild] How to run a target only it hasn't run?

I have a NAnt script like below: <target name="Init" unless="${target::has-executed('Init')}"> What I want is to convert it into MSBuild script. What I can't do is to write MSBuild script to run a target only when it hasn't run like the above script. Please help. ...

How to exclude tags folder from triggering build in Teamcity?

Hello, I recently installed Teamcity 5.0.3. I am trying to setup automated build for a .NET 2.0 VS2005 project. I use NAnt and MSBuild task to perform the build. The project structure is a typical SVN structure svn://localhost/ITools is my repository and the project structure is VisualTrack trunk branches tags I created a new ...

How to convert 'if' condition in NAnt into MSBuild?

I have a NAnt script like below: <if test="${a}>${b}"> <call target="target"/> </if> What I want is to convert it into MSBuild script. I found that there is tag to write conditions but it is only used for defining property/item. Can we write 'if' condition in MSBuild? Please help! ...