msbuild

How to stop Visual Studio caching Imported MSBuild scripts?

I have a csproj file which references a shared MSBuild script with an <Import> directive. I have noticed that when I change the shared script, I need to close and reopen Visual Studio before it notices the change - a build within Visual Studio notices changes to the csproj file but not the shared file. This doesn't happen when I build ...

Can I use the ReplaceConfigSections task in a non-web config file?

Brennan Stehling blogged back in 2007 about how to make use of the MSbuild tasks in Web Deployment Projects to merge web.config files directly in an MSBuild script without having to create a separate WDP project. I'd like to use this technique in a non-web project (in this case a Windows Service exe app). I'm currently trying this dire...

MSBuild.exe not accepting either /p:DefineConstants nor /p:PreprocessorDefinitions

I've been through quite a number of articles on stack overflow that answered the question "How do I pass preprocessor definitions to the compiler from the MSBuild command line," and they all responded with some variation of: MSBuild.exe /p:DefineConstants=THING_TO_BE_DEFINED I have tried every variation that I could come up with: MSB...

Publish an web application on build with NAnt, MSBuild or any other tool

I have a scenario where I have to setup a test environment where I want to be able to tell my NAnt or other build tool to make an new IIS web application, put the latest bins in the newly created IIS web application, and post me an email where the new address and port where the new application are addressed, is this possible and how? whi...

Encoding of copied file in MsBuild

Hi all: 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 caused some major problems with my build process, as I was expecting the copied files to still be in ANSI format. I want the copied...

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 the following regex: <FileUpdate Files="@(AssemblyResult)" Regex='(\[\s*assembly:\s*Ass...

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. ...

MSBuild ItemGroup won't list multiple files from a windows share

I'm having trouble getting an ItemGroup to store the files on a Windows share. If I use a local folder ItemGroup contains the list of files, if I use an address in the form of \\machine\share the ItemGroup is empty. My target includes the following: <ItemGroup> <FilesToDelete Include="$(WebServer)\**\*" /> </ItemGroup> <Delete File...

Building VS2008 solution using MSBuild 2010?

Is it possible to build a VS2008 solution (C# and VC++ projects) using the automated MSBuild built into TFS2010? When I niavely just run it, the build fails because the 2008 Solution file needs to be upgraded (and presumably so would the project files). Can I tell MSBuild 2010 to just build the 2008 files? ...

Making TeamCity integrate the Subversion build number into the assembly version.

I want to adjust the output from my TeamCity build configuration of my class library so that the produced dll files have the following version number: 3.5.0.x, where x is the subversion revision number that TeamCity has picked up. I've found that I can use the BUILD_NUMBER environment variable to get x, but unfortunately I don't underst...

Difficult and confusing problem with MsBuild target command when running Jar file

Hi all: I have a strange problem which I would like to hear from all the experienced developers out there... Currently I have a MsBuild file with a target that executes a set of unit tests using a Java jar file. The target looks like this: <Target Name="RunTests" > <MSBuild Projects="MyProject.csproj" /> <Exec ContinueOnError="fa...

How to read the assemblyversion from assemblyInfo.cs??

Hii, there are many others had already post so many question about this..But here the scenario is different. I need to extract the first three digits ie. $(major).$(Minor).$(Build) from version number. how can i do this??..i tried AssemblyInfo Task..but that task is just for overwriting the version number.not to extract the version numb...

MSBuild not compiling MSTest projects (from TeamCity)

Im using MSBuild 10 to compile a .Net solution file which includes a MSTest project. Im using MSBuild from within TeamCity. MSBuild doesnt seem to be building the test project and so the test project dll isnt created for use by MSTest, although the other projects are compiled OK. What do I need to do to get the test project to compile ...

Retrieve the full output from a web application with MSBuild

Hi, I have a misunderstanding with MSBuild. I want to build a web application (with a traditional .csproj project file) and get the "entire output" of the build in a new, clean output folder - including all the website files that are included in the project with <Content Include=".... The AspNetCompiler utility makes this easy for "web...

How to suppress all warnings using MSBuild

How would I suppress all warnings (or at least as many as possible since those prefixed with MSB cannot be suppressed How to suppress specific MSBuild warning)? ...

Get a Visual Studio project (MSBuild) to know the Team Build output location.

I have this custom build step form my project: <Target Name="BeforeBuild"> <WriteLinesToFile Condition="" File="$(OutputPath)\env.config" Lines="$(Configuration)" Overwrite="true"> </WriteLinesToFile> </Target> Basically it outputs the build configuration to a file. This works fine when building in Visual Stud...

Automating cygwin commands in windows command line (and ultimately in MsBuild)

Hi all: I have a situation where I have a few cygwin commands which I wish to be run in Windows command line e.g. chmod 777 /home/administrator/* Currently I have to manually type in cygwin.bat, then enter the above command in cygwin. I was wondering whether it is possible (and if so, how) to have these steps automated in Windows co...

Declaring dynamic profile path in MsBuild

Hi all: 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="JsProject.csproj" /> <Copy SourceFiles="$(ProjectDir)\myScript.js" DestinationFolder="$(systemdrive)\Documents and Settings\$(userProfileNa...

Problem with Nhibernate.Bytecode.Castle in MSBuild (TFS)

We have a Fluent NHibernate mapping test that is passing on our local machines, but when we check in to TFS, the tests are failing on the build server. We are using MSTest. The error we get is: NHibernate.Bytecode.UnableToLoadProxyFactoryFactoryException: Unable to load type 'NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.By...

Enumerating Folders With MSBuild

Hello, I am coming up on the end stages of an Asp.Net MVC 1.0 project in VS2008 / Framework 3.5, and trying to do some performance optimizations. In my project, I have a few different "themes" that are used, depending on the role of the logged in user. My themes folder structure is like so... \Themes \Theme1 \Css ...