msbuild

MsBuild Task: Register Com Component on remote/deployed-to machine?

I am currently still fiddling with our msbuild & deployment script and one of the steps is to register a (legacy) com component on the machine the code is deployed to. Is there any 'elegant' way to accomplish this or would I have to call the regsvr32.exe via wmi on the remote machine? ...

Updating web.config with an MSBUILD task

I'm using an Web Deployment project to do a few post build tasks on a website I'm deploying. I want to use a FileUpdate task to update my web.config and change the compilation mode from debug="true" to debug="false". So, from this <compilation defaultLanguage="c#" debug="true" /> To this <compilation defaultLangua...

MSBuild taking forever to check timestamps when started from VS

I have a MSBuild file that uses item batching to send a bunch of files into a task. The target uses a vector of items for input and output. When I run msbuild from the command line (I run make which then blindly calls msbuild), msbuild checks timestamps almost instantly and skips task execution (nothing to build). When I call make from...

MSBuild: asterisks and strange ItemGroup Exclude behaviour

I have a script that attempts to construct an ItemGroup out of all files in a certain directory while excluding files with certain names (regardless of extension). The list of files to be excluded initially contains file extensions, and I am using Community Tasks' RegexReplace to replace the extensions with an asterisk. I then use this ...

MSBuild XMLUpdate Question

Hi Everyone, I am using the XMLUpdate to update an xml formatted file in MSBuild. It updates fine but adds <?xml version="1.0" encoding="utf-8"?> at the top after update. Here is my statement that updates <Import Project="C:\Program Files\MSBuild\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets" /> <XmlUpdate XmlFileName="$(AppNa...

Minify inline javascript during build for ASP.net?

We have a handful of ASP.net pages that include more than 50+ lines of javascript specific to that page. We'd like to minify that javascript during our CruiseControl build process. We already use the YUI Compressor to compress our full javascript and css files. But we can't figure out how to do the Inline javascript. Is there an MSBu...

Built with optimizations enabled or without debug information

I'm currently trying to find out why my InjectableAttributes never get to the filter part. Therefor I linked in the source project directly so I could easily put breakpoints etc. When I build however I get the following message: The following module was built either with optimizations enabled or without debug information: C:\WINDOWS\M...

Getting a Target to run BEFORE anything else runs when building from Visual Studio

Hi, I'm trying to get a one-time costly target to run only when building a certain top-level project (that has many dependencies). I have no problem on getting this working from plain msbuild / command line build. I do this with setting and InitialTargets on the project, or alternatively with < BeforeBuild />. The tricky part is ...

MSBuild: how to create a global property?

When running MSBuild, anything passed in on the command line using /p:MyProp=value is accessible from every MSBuild script invoked (via the MSBuild task) from the main script. How can I define a property that is similarly accessible from every script, in a task? For example: Script1.proj: [...] <Target Name="Test"> <MSBuild Projects=...

Select Files containing a certain substring in MSBuild

Suppose I have a bunch of files in a folder: foo.test.txt bar.txt ... And I want to create an ItemGroup to exclude files containing ".test." somewhere in the title, how would I do that in MSBuild? <!-- Can't change this part --> <Items Include="*.txt" /> <CreateItem Include="@(Items)" Condition="'%(Items.Exclude)'!='true' AND (???)"...

using msbuild to create a sql database

Is there a good tutorial for Creating a database using msbuild? jean paul boodhoo does it using nant in this post. he sets properties to be used in an nant build file <properties> <property name="sqlToolsFolder" value="C:\Program Files\Microsoft SQL Server\90\Tools\Binn"/> <property name="osql.ConnectionString" value="-E"/> <pr...

Read Config Value in MSBuild Task

Is there a way to read a System.Config connection string in an MSBuild task? Basically I have my connection string setup in a config file <add name="MyApp.MyConnectionString" connectionString="..." /> And I would like to reference it in an MSBuild task like so ... <Target Name="Migrate" DependsOnTargets="Build"> ... <Migrate...

_CopyWebApplication with web.config transformations

I am trying to have my web application automatically Publish when a Release build is performed. I'm doing this using the _CopyWebApplication target. I added the following to my .csproj file: <!-- Automatically Publish in Release build. --> <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microso...

compile multiple dlls

I have to compile multiple dlls (around 100) for my project. Each project/build will have only one source code file different. These dlls should have an index included. Like calc0023.dll What is the easiest way to do that? ...

How to reference different version of dll with MSBuild

I have a web application project which utilises a set of 3rd party dll's. The issue is that the dev/staging environment is 32bit, but production is 64bit. As such, we have to re-reference and build the solution each time we want to deploy. I am now wanting to automate this, but unsure how to go about it with MSBuild? All other dll's ar...

Force the culture of a console command

I want to execute a msbuild script using a specific culture (en-US) as one of the tasks is trying to call a web service using aDateTime.ToShortDateString() as a parameter, and my current culture is uncompatible with the server's (english) format. How to do it without altering my regional settings ? ...

TFS: Is this possible?

We have 3 environments: dev, test, and staging. I want to check in and out of TFS. When we make changes, I want to promote the code to the dev web server. Next I want to promote the changes to test, then to staging. Would it be possible to do this with Team Foundation Server? ...

Is there a standard file extension for MSBuild files?

Is there a standard file extension for MSBuild files that are not project files but instead more complex build scripts? I was thinking .msbuild.proj to avoid confusion with other .proj files (which I am aware are actually MSBuild files). ...

MSBuild - Assemblies differ slightly after each clean+build

Hi, I'm trying to work with an existing home grown implementation of click-once. Currently we manually update the manifest for assemblies that we actually changed. I'm attempting to make it automatic based on a binary comparison of the existing assemblies and the newly built assemblies. Unfortunately, it seems that each time I run cl...

ItemGroup With Custom Metadata regarding files

I’m trying to create a “Files” task item group with a metadata attribute called “TargetPath” populated with the relative path to a file. Example: For these paths: D:\Test\Blah.exe D:\Test\Config\fun.config D:\Test\en-US\my.resources.dll The output should be: File Target = Blah.exe File Target = Config\fun.config File...