msbuild

Create an ItemGroup of strings in MSBuild

I want to create an "ItemGroup" of arbitrary strings / names in order to use MSBuild transforms, for example: <ItemGroup> <Categories>First</Categories> <Categories>Second</Categories> </ItemGroup> I then wish to pass a transform of these categories into a console app, e.g.: /c @(Categories, ' /c ') The reason why I say "It...

How to publish a full website without compiling and without copying SVN files

Apparently, DNN installations do not like to be precompiled (they won't be able to find any localized strings then). Our installation is safely put in SVN, which means I cannot just copy the whole directory. To publish everything, I need to copy the whole website directory without the SVN files and directories. So far, I've been messing ...

Find out the "Bit"ness of the current OS in MSBuild

I have a build script that needs to hard code a path to an executable. The path is: C:\Program Files\Microsoft Visual Studio 9.0\SmartDevices\SDK\SDKTools\cabwiz.exe This has worked fine, but now I am running on a 64 bit OS (but my coworker and build server are on 32 bit still). I need the path to be this for me: C:\Program Files...

WIX 3.5 fails under NAnt but not under VS2010

Hi, I know this a is a common issue, but everything I can find in the forums seems to relate to 64bit framework incompatability (which is not an issue in my case). I have a set of simple WIX 3.5 installers developed using Votive that I can compile happily in VS2010, but when I try to compile them via NAnt (and MSBuild) on TeamCity (i....

MSBuild calling incorrect version of csc.exe

I am using team city to call a nant script, currently this nant script is very simplistic and only calls an msbuild task on a single project in the solution. The build is failing, it looks like msbuild 3.5 is being called, but it is incorrectly calling the csc.exe from the .net 2.0 folder. Since we are using .net 3.5 language features t...

C# project preserve consecutive build outputs (command line build)

I am building a windows forms application from the command line, twice. The first time I specify an output name "A", the second time I specify "B" (using /p:AssemblyName="..." as parameter). However the result of the first build (A) is replaced during the second build, and I end up only with B. How can I prevent this? ...

Msbuild: Delete files older 6 months

I want delete files in a folder, which are more than six months old -older than 6 months-using Msbuild. I want use %ModifiedTime (Well-known Item Metadata) of MsBuild I prefer not use customs Tasks, only msbuild default and Microsoft.Sdc.Tasks. I use VS 2008, .net .35. any suggestions ? <Target Name="SomeTarget"> <ItemGroup> <...

MSBuild TargetOutputs doesn't include Foo.exe.config file?

I'm using the MSBuild task as follows: <MSBuild Projects="Foo.csproj"> <Output TaskParameter="TargetOutputs" ItemName="FilesToDeploy" /> </MSBuild> However, the FilesToDeploy item group only includes the .EXE files built by the project file; it doesn't include the Foo.exe.config file. Another question: Who copies App.config to Ap...

MSBuild and .CsProjects

I am using MSbuild for CI tool and have many C# projects located in different directories. There many dependents projects as well. Some developers use Add Project option to add project and some directly connect to .dll file and i have no control over it. some cases all projects added to a solution So if i compile that solution then it t...

TFS2010 Build Definition to Deploy to multiple servers?

I've been looking into TFS2010 new build and deployment features with MSDeploy. So far everything is going well (although its been hard to find information about specific scenarios). Can I modify my Build Definition to specify 2 or more servers to deploy to? What I need to do is deploy to multiple servers (as I have two in my testing en...

msbuild across different solutions

We've started to separate out our single VS solution into multiple solutions for better maintenance. I am wondering if there is any best practice out there for msbuild script that build across multiple solution that may depend on the same project dll. For example: solution 1 contains [proj1 and proj2] solution 2 contains [proj3 which ...

How can I read the OutputDirectory property from a vcproj (2008) file in a wrapper script?

I am trying to write an MSBuild wrapper script that builds a vcproj (well, a solution containing vcproj files) and then copies the output of a particular vcproj file into a special "package" directory that is in turn published out to a file share. I need to do this for several Configurations and Platforms (Debug, Release, Win32, x64). ...

external file to hold msbuild tasks

I have created some ms build tasks for my VS project. Rather than having to update the VS Project file with each of the tasks, is it possible to create an external file to hold the build tasks and reference it via the main project file? Also, I have seen with nant, that you can create .bat file to run nant tasks. Is it possible to do s...

MsBuild: Changing References from ProjectReference to Reference

In our environment, we have two in-house frameworks and a separate website. During development, the references to the in-house frameworks tend to be set tp project references. However, once we move to release, the in-house frameworks are installed into the GAC as they are used for multiple instances of the website on each server. All ...

MSBuild failing to expand environment variables

I'm pretty new to MSBuild, so I might be doing something obviously-wrong, but a colleague of mine who's worked with MSBuild a lot can't see any error, so I figured I'd post here and see if anyone else can see it. I'm converting an old batch file that we used to call ant to MSBuild tasks (because we want to call it from MSBuild) and the ...

Creating extra type definitions at compile time

Recently I've been working with MSTest, and I noticed that the testframework generates accessor classes dynamically at compile time. How can one do this? There's an xml file in a VS2010 C# project. I'd like to make an enum out of certain data in this xml file. Can this be done? And if so, how? ...

F# project references not working when targeting x64 platform in Visual Studio 2010

Hi, I have an F# library project that depends on a C# class library project, both in the same solution. Essentially in the F# code, I do open MyLib (where MyLib is the name of the C# project), and access some code defined in the C# project. I compile and both projects build without errors or warnings. If I then change the target from A...

Impersonate a user to execute TF.exe

Hi, Is there a way to provide credentials to get latest files from TFS using TF.exe command line utility? My company was recently took over by another company. After acquisition, my machine was imaged as per new company's policy. I will be able to access the old company's domain over VPN. The TFS server belongs to old company's and acces...

ASP.NET when am I meant to build my project

Hi, Totally stupid question, but I'm writing my first ASP.NET C# web forms application and sometimes I can just write a change and save it in Visual Studio and it works just dandy, but other times it seems I have to rebuild the project for changes to take effect. Could anyone please tell me what conditions need to be met for me to rebu...

TFS Build Script Tracing

When debugging a build script, is it possible to get TFS to use a build script that is currently checked out? For example, I currently have a build script that I'm trying to debug, but in order to add a line of trace, I need to book out the TFSBuild.proj, change it, and then book it back in. ...