Question

I would like to be able to delete a project reference in a solution file via MSBuild.

I am assuming I can do this using the FileUpdate task; however, I am not sure how you turn on the multiline regex feature. Essentially, I need to delete a reference such as: delete everything between Project and EndProject where those lines contain DELETEME. I know I can use word boundaries if I knew how to turn on the mulltiline feature. IF someone has a better idea that is welcome too. Thank you:

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DELETEME", "DELETEME.csproj", "{08F67FEA-5A63-4A46-B38F-
26EF15E003A9}"
EndProject

<FileUpdate
  Files="PATH TO SOLUTION"
  Regex="PATTERN"
  ReplacementText=" " />

I can't find documentation on the parameters of this task anywhere either :/ Maybe something like RegexOptions = "Multiline"

Was it helpful?

Solution

I would personally prefer writing a custom activity which does the cleaning for me.

Ewald Hoffman has a series of blog posts about customizing Team Build workflows. Part 5 especially describes a writing a custom activity to automatically update assembly version, which, with a little change, can be applied to your situation.
http://www.ewaldhofman.nl/post/2010/05/13/Customize-Team-Build-2010-e28093-Part-5-Increase-AssemblyVersion.aspx

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top