msbuild

Throw an Error in an MSBuild Task

How do you throw an error from within an MSBuild task and force the build to fail. Something like: <Task> <ThrowError Condition="$(SomeCondition)" Message="There was a problem with the build" /> </Task> ...

Get publish directory in MSBuild

I have an asp.net mvc application that I am publishing with Publish feature of Visual Studio and I have a custom MSBuild task that needs the directory that I am publishing to so it knows where to copy some custom build files to... I've tried $(OutDir), $(PublishDirectory) and a bunch of others... how do I get this path? ...

Can I batch based on a Property (not just Items)?

I have a property group, like so: <PropertyGroup> <Platform>Win32;x64</Platform> </PropertyGroup> And I want to batch in an Exec task, like so: <Exec Command='devenv MySolution.sln /Build "Release|%(Platform)"' /> But of course, as written I get an error: error MSB4095: The item metadata %(Platform) is being referenced without...

XAML Parsing Exception

I have a simple XAML page that load fine when it is loaded as part of any application within Visual Studio. However, when I deploy this application using ClickOnce, I get the following exception: Type : System.Windows.Markup.XamlParseException, PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 ...

Binding hudson build number in C# project

Hi, Is there a way to bind the hudson successful build's number in the C# WPF application? Meaning, on running the exe after building I want to show the build number say 10 in my application somewhere. In project configuration file, I have used ${BUILD_NUMBER}, that a hudson understands and creates a build with the revision number. If I...

How to edit Build system paths in Visual Studio 2005

Hi, I want to change the build system path for building my VC++ project in VS2005. When I try to build the project, I'm getting an error that a specified header file cannot be opened. I have that header file in "Microsoft SDKs\Windows\v7.0\Include". But the path present in 'Build system path' is "Microsoft SDKs\Windows\v7.0\Include...

[MSBuild] Can not run MSBuild Community Task 'WebDirectoryDelete' and 'WebDirectoryCreate'

I have a new default ASP.net website and use MSBuild Community Task WebDirectoryDelete to delete and WebDirectoryCreate to create the IIS virtual directory. I can't get it done. It raise error : Unknow error 0x80005000. I retry by running the msbuild under "Run as Administrator" but the errors still appear. I'm using Windows 7 and dot...

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 and the .min.js files are output to the same directory as the original files. When I try to deploy using the Publish feature in Visual Studio...

Build error For Web Application in VS2008 when Intellisense Works

When building the solution, the code behind is not picking up changes made to the applicaitons dlls. Intellisense works, and the page builds when using the "Build Page" command, however when trying to build the entire solution the build fails. Does anyone know why this might be? ...

Microsoft.Sdc.Tasks.Web.WebSite.CreateVirtualDirectory fails with Access is Denied with IIS 6.0 (script run on XP)

've done a bit of searching around and have been unable to find a solution that works. I'm trying to automate deployment of a webapp to IIS. My environment is as follows: Server: Windows 2k3 with IIS 6 & .net 3.5 SP1 Dev box: Windows XP pro .net 3.5 SP1 The user that I'm running my msbuild script from is an admin on the dev box (th...

How to escape quote marks in Exec Command in MSBuild

I'm trying to build an MSBuild script that maps a network drive to a drive letter in the script, but unfortunately the path to the target folder includes an embedded space. The embedded space causes the mapping to fail, and I don't know if it is possible to escape quotes around the path. I've tried double quote marks, but MSBuild doesn...

How to obfuscate web app before publishing?

I have a Visual Studio 2008 solution with number of DLLs and web application uses them as a main project. It's a commercial banking and accounting software (thin client) and I don't want a client getting access to the source in circumvention of mine. I want to obfuscate all resulting assemblies before publishing them onto a web server v...

Perforce tasks for MS Build

Are there any community MSBuild tasks for Perforce (e.g. even just basic syncing)? Neither the MSBuild Community tasks or MSBuildExtenstion pack seem to have any. ...

How can I get the path of the current msbuild file?

hi, I'm writing an msbuild .targets file, and in it I want to use the zip task to zip up some files that I know the locations of relative to the .targets file. This works ok when I execute the .target file directly. But, when I include the .targets file in an .proj file that's in another directory, the relative paths are resolved relat...

Target specific version of .NET with MSBuild

I have a solution that is being referenced by a MSBuild project. In the solution, I am referencing several projects that are targeting .NET 4.0. How can I tell MSBuild to ignore the project's configuration and just target .NET 3.5? ...

How to determine if a target will be executed?

Hi, I'm writing an msbuild file and have something like this: <ValidateDependsOn>$(ValidateDependsOn);ValidateA</ValidateDependsOn> <ValidateDependsOn>$(ValidateDependsOn);ValidateB</ValidateDependsOn> <Target Name="BuildA"> <!-- stuff --> </Target> <Target Name="BuildB"> <!-- stuff --> </Target> <Target Name="ValidateA"> ...

How to suppress DISPPARAMS warnings in msbuild?

I have bunch of COM dependencies and my build script emits tons of following warnings: c:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets : warning : The type library importer could not convert the signature for the member 'DISPPARAMS.rgvarg'. c:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets :...

How do I specify a keys password with MSBuild for the purpose of using Hudson?

We have just setup our hudson server to build .NET projects which seems to be working fine, however for projects that require a password when signing the assemblies I can not figure out how to tell hudson what the password is? For us the password is asked the first time a developer checks out the source code and they open with visual st...

How do I specify a project dependency with Hudson?

We have common library projects shared amongst many projects that are required to be checked out into a "Libraries" folder which a developer needs to checkout prior to opening the main project in visual studio. How I tell hudson that there is this dependency? I figured one thing I could do is setup a custom workspace and specify the lo...

How do I select all read-only files with msbuild?

Hi, I'm trying to write an MsBuild script to zip some files up. I need to select all of the read-only files recursively from a folder into an ItemGroup to add to the zip. I'm using the community tasks Zip task, but am struggling with selecting files based on their attributes. Is there anything around to do this out of the box, or do I...