Thursday, August 18, 2011

Simple Nant Build file - revert switch update

Nant you might all know is a powerful tool when creting builds.It offers lot of flexibility when it come to building projects.Nant along with subversion and wix can make your life easier to build your app.Here is a simple post that shows you how to use nant and get files.

Following script does
1.Clenup
2.Switch
3.remove unversioned files and directories
 4.revert
5.update

<?xml version="1.0" encoding="utf-8"?>
<project name="testscriptfile" default="build" basedir=".">

<property name="subversion.username" value="YourUserName" />
<property name="subversion.password" value="YourPassWord" />

<property name="subversion.projectpath" value="YoutPath" />
<property name="dir.project" value="yourPhysicalFilesPath" />

<property name="subversion.revision" value="-1" />
<property name="subversion.projectpathwithrevision" value="" />

<target name="setdependencyproperties">
<property name="subversion.projectpathwithrevision" value="${subversion.projectpath}" />
<if test ="${subversion.revision > '-1'}">
<property name="subversion.projectpathwithrevision" value="${subversion.projectpath} -r ${subversion.revision}" />
</if>
</target>


<target name="build" description="gets the latest files from subversion" depends ="setdependencyproperties">

<echo message="#######################################" />
<echo message="CLEANING : ${dir.project}" />
<echo message="#######################################" />
<exec program="svn" commandline="cleanup ${dir.project}" />
<echo message=" " />


<echo message="#######################################" />
<echo message="REVERTING : ${dir.project}" />
<echo message="#######################################" />
<exec program="svn" commandline="revert --recursive ${dir.project}" />
<echo message=" " />

<echo message="#######################################" />
<echo message="REMOVING UNVERSIONED FILES/DIRS FROM : ${dir.project}" />
<echo message="#######################################" />

<exec program="cmd">
<arg value="/k"/>
<arg value="for /f &quot;tokens=1*&quot; %i in ('svn status ${dir.project} ^| find &quot;?&quot;') do del /q &quot;%j&quot;"/>
</exec>

<exec program="cmd">
<arg value="/k"/>
<arg value="for /f &quot;tokens=1*&quot; %i in ('svn status ${dir.project} ^| find &quot;?&quot;') do rd /s /q &quot;%j&quot;"/>
</exec>

<echo message=" " />

<echo message="#######################################" />
<echo message="SWITCHING : ${subversion.projectpathwithrevision}" />
<echo message="#######################################" />
<exec program="svn" commandline="switch ${subversion.projectpathwithrevision} ${dir.project} " />
<echo message=" " />

<echo message="#######################################" />
<echo message="GETTING FILES FROM : ${subversion.projectpathwithrevision} TO ${dir.project}" />
<echo message="#######################################" />
<exec program="svn" commandline="update --username ${subversion.username} --password ${subversion.password} ${subversion.projectpathwithrevision} ${dir.project}" />

</target>
</project>

StatusStrip missing windows vb.net c# mdi windows forms application


All of a sudden the status bar in our MDI windows forms application is lost when you resize the form smaller.

Here is the scenrario

MDI Parent -  Has a StatusStrip that contains 3 ToolStripLabels that has spring property set to false.

MDI Child - Has a StatusStrip that contains 1 ToolStripLabel that has spring property set to true.MDI Child form size is 1280 x 1024 (design time).

In the mdi child activate event of the mdi parent , the statusstrip from the mdi child is merged into the statusstrip of the mdi parent using the ToolStripManager.Merge method.

It seems the problem is "toolstriplabel" in mdi child spring is set to true and the width of the toolstriplablel is close to 1280(form width).So when you resize your mdi parent smaller than the design width of the toolstriplabel is trying to steal the 1280 width, as it is not available it went some where, also it is pushing the labels in the mdi area go out of the visible area.

To fix this problem ;
1.make the toolstriplabel spring to false and make it smaller(min width that your form can go)
2.merge the statusstrips
3.set the spring property of the toolstrip label(from the mdi child) in the mdi parent after you do the merge to TRUE.

Hope this helps some one out there.!!!