Just wanted to let everyone know that my Sedodream MSBuild Project now has an MSI that can be downloaded. You can find that latest downloads at http://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=Sedodream. The installer will place all MSBuild tasks in the %Program Files%\MSBuild\Sedodream directory. In your MSBuild project files you can refer to this location as $(MSBuildExtensionsPath)\Sedodream\.
Here is a list of what is currently included in the project
Tasks Included
|
Name |
Description |
|
AddMetadata |
Allows you to add metadata to an item |
|
FindUnder |
Finds and returns all directories (empty or not) under a specified path |
|
GetDate |
Returns a string representation of the date in a specified format |
|
GetRegKey |
Returns the value of a registry key |
|
Move |
Task to move a file (or set of files) |
|
NUnitTask |
Task to run NUnit test cases as a part of the build process |
|
TempFile |
Returns the path to a new temporary file |
|
ReplaceInFile |
Can be used to replace specified text in a file. |
|
GetExternalIp |
Can be used to determine the external IP address of the executing machine |
|
GetInternalIp |
Can be used to determine all the Internal IP addresses of the executing machine |
Loggers Included
|
Name |
Description |
|
EmailLogger |
An MSBuild logger capable of emailing the resulting log |
|
SimpleFileLogger |
A simple MSBuild file based logger |
|
XmlLogger |
An MSBuild logger which creates an Xml file |
Sayed Ibrahim Hashimi
Monday, November 13, 2006
There were a couple of posts in the MSBuild forum recently related to customizing the build process. The specific thread is, Forcing a Clean build. The question boils down to, "How do you force a clean each time I build?" The answer lies in adding the Clean target to the build targets dependency list. You can read details on how this works in my MSDN article Inside MSBuild.
One of the participants asked me to post a complete solution of how to do this. So that response is this entry. I created a sample Windows Application that has the build process customized. I called this BeforeBuildEx, you can download all the files at the end of this entry. I modified the WindowsApplication1.csproj file and added the following lines:
<PropertyGroup>
<BuildDependsOn>
Clean;
MyBeforeBuild;
$(BuildDependsOn);
MyAfterBuild
</BuildDependsOn>
</PropertyGroup>
<Target Name="MyBeforeBuild">
<Message Text="This is before the build." Importance="high"/>
</Target>
<Target Name="MyAfterBuild">
<Message Text="This is after the build." Importance="high"/>
</Target>
The list of targets that must be executed for a build is contained in the BuildDependsOn list. So if you change that list, you change to build process. If you want to add a target before the build process, add that target to the begining of the list. In the above statement, I'm actually extending the previous list by adding my targets. I add 2 targets before and 1 after the already existing definiton for BuildDependsOn. Much more detail about this in my article. The snippet above was inserted after the statement
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
This is very important, otherwise your customizations may be overwritten. Now if you build this you will see that the Clean target is executed when the application is built. If you want to see this in Visual Studio you have to increase the verbosity of the MSBuild output that is shown on the Output window. Do this by: Tools->Options->Projects and Solutions->Build and Run and set the value for MSBuild project build output verbosity to atleast Normal. The link to the zip file is below. In some cases this could cause some problems for Visual Studio.
BeforeBuildEx.zip
Sayed Ibrahim Hashimi